xref: /netbsd-src/external/gpl3/binutils/dist/gprofng/src/IOActivity.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
2    Contributed by Oracle.
3 
4    This file is part of GNU Binutils.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3, or (at your option)
9    any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, 51 Franklin Street - Fifth Floor, Boston,
19    MA 02110-1301, USA.  */
20 
21 #ifndef _IOACTIVITY_H
22 #define _IOACTIVITY_H
23 
24 
25 #include <stdio.h>
26 
27 #include "vec.h"
28 #include "Histable.h"
29 #include "Hist_data.h"
30 #include "Metric.h"
31 #include "FileData.h"
32 #include "DefaultMap.h"
33 #include "dbe_types.h"
34 
35 class Experiment;
36 class Expression;
37 class DataView;
38 class DbeView;
39 
40 class IOActivity
41 {
42 public:
43 
44   IOActivity (DbeView *_dbev);
45   void reset (void);
46   Hist_data *compute_metrics (MetricList *, Histable::Type, Hist_data::Mode,
47 			      Histable*);
48 
~IOActivity()49   ~IOActivity ()
50   {
51     this->reset ();
52   }
53 
54 private:
55   void computeData (Histable::Type);
56   void computeCallStack (Histable::Type, VMode viewMode);
57   void createHistItemTotals (Hist_data *, MetricList *, Histable::Type, bool);
58   void computeHistTotals (Hist_data *, MetricList *);
59   void computeHistData (Hist_data *, MetricList *, Hist_data::Mode, Histable *);
60 
61   Vector<FileData*> *fDataObjs;
62   Vector<FileData*> *fDataObjsFile;
63   Vector<FileData*> *fDataObjsVfd;
64   Vector<FileData*> *fDataObjsCallStack;
65   bool hasFile;
66   bool hasVfd;
67   bool hasCallStack;
68   HashMap<char*, FileData*> *fDataHash;
69   FileData *fDataTotal;
70 
71   // list of FileData objects using the stack id as the key
72   DefaultMap<void*, FileData*> *fDataCalStkMap;
73 
74   // list of FileData objects using the VFD as the key
75   DefaultMap<long, FileData*> *fDataVfdMap;
76 
77   // the cached data for mode=Hist_Data::ALL
78   Hist_data *hist_data_file_all;
79   Hist_data *hist_data_vfd_all;
80   Hist_data *hist_data_callstack_all;
81   Hist_data *hist_data_callstack;
82 
83   DbeView *dbev;
84 };
85 
86 #endif /* _IOACTIVITY_H */
87