[gdb/testsuite] Fix license text in gdb.reverse/map-to-same-line.{c,exp}
[binutils-gdb.git] / gprofng / src / HeapData.h
blobc64f30c53ba7d39272d8e0617d777462d08ca267
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
2 Contributed by Oracle.
4 This file is part of GNU Binutils.
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.
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.
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. */
21 #ifndef _HEAPDATA_H
22 #define _HEAPDATA_H
24 #include "gp-defs.h"
25 #include "gp-time.h"
27 #include "vec.h"
28 #include "data_pckts.h"
29 #include "Histable.h"
31 #define TOTAL_HEAPNAME NTXT("<Total>")
32 #define TOTAL_STACK_ID 0
33 #define _1KB 1024
34 #define _8KB 8192
35 #define _32KB 32768
36 #define _128KB 131072
37 #define _256KB 262144
38 #define _512KB 524288
39 #define _1000KB 1048576
40 #define _10MB 10485760
41 #define _100MB 104857600
42 #define _1GB 1073741824
43 #define _10GB 10737418240
44 #define _100GB 107374182400
45 #define _1TB 1099511627776
46 #define _10TB 10995116277760
48 class HeapData : public Histable
50 friend class HeapActivity;
51 public:
52 HeapData (char *sName);
53 HeapData (HeapData *hData);
54 ~HeapData ();
55 char *get_raw_name (Histable::NameFormat nfmt);
56 void init ();
57 void setStackName (char* sName);
58 void setPeakMemUsage (int64_t pmu, uint64_t sId, hrtime_t ts, int procId, int uei);
60 virtual char *get_name (Histable::NameFormat nfmt);
61 virtual void set_name (char * _name);
62 virtual Histable *convertto (Histable_type, Histable* = NULL);
64 virtual Histable_type
65 get_type ()
67 return histType;
70 virtual uint64_t
71 get_addr ()
73 return stackId;
76 uint64_t
77 get_index ()
79 return stackId;
82 char *
83 getStackName ()
85 return stackName;
88 void
89 addAllocEvent (uint64_t nb)
91 allocBytes += nb;
92 allocCnt++;
95 uint64_t
96 getAllocBytes ()
98 return allocBytes;
101 int32_t
102 getAllocCnt ()
104 return allocCnt;
107 void
108 addLeakEvent (uint64_t nb)
110 leakBytes += nb;
111 leakCnt++;
114 uint64_t
115 getLeakBytes ()
117 return leakBytes;
120 int32_t
121 getLeakCnt ()
123 return leakCnt;
126 void
127 setStackId (uint64_t sId)
129 stackId = sId;
132 uint64_t
133 getStackId ()
135 return stackId;
138 void
139 setTimestamp (hrtime_t ts)
141 timestamp = ts;
144 hrtime_t
145 getTimestamp ()
147 return timestamp;
150 void
151 setHistType (Histable::Type hType)
153 histType = hType;
156 Histable::Type
157 getHistType ()
159 return histType;
162 int64_t
163 getPeakMemUsage ()
165 return peakMemUsage;
168 Vector<uint64_t> *
169 getPeakStackIds ()
171 return peakStackIds;
174 Vector<hrtime_t> *
175 getPeakTimestamps ()
177 return peakTimestamps;
180 void
181 setPid (int procId)
183 pid = procId;
187 getPid ()
189 return pid;
192 void
193 setUserExpId (int uei)
195 userExpId = uei;
199 getUserExpId ()
201 return userExpId;
204 void setAllocStat (int64_t nb);
206 int64_t
207 getASmallestBytes ()
209 return aSmallestBytes;
212 int64_t
213 getALargestBytes ()
215 return aLargestBytes;
218 int32_t
219 getA0KB1KBCnt ()
221 return a0KB1KBCnt;
224 int32_t
225 getA1KB8KBCnt ()
227 return a1KB8KBCnt;
230 int32_t
231 getA8KB32KBCnt ()
233 return a8KB32KBCnt;
236 int32_t
237 getA32KB128KBCnt ()
239 return a32KB128KBCnt;
242 int32_t
243 getA128KB256KBCnt ()
245 return a128KB256KBCnt;
248 int32_t
249 getA256KB512KBCnt ()
251 return a256KB512KBCnt;
254 int32_t
255 getA512KB1000KBCnt ()
257 return a512KB1000KBCnt;
260 int32_t
261 getA1000KB10MBCnt ()
263 return a1000KB10MBCnt;
266 int32_t
267 getA10MB100MBCnt ()
269 return a10MB100MBCnt;
272 int32_t
273 getA100MB1GBCnt ()
275 return a100MB1GBCnt;
278 int32_t
279 getA1GB10GBCnt ()
281 return a1GB10GBCnt;
284 int32_t
285 getA10GB100GBCnt ()
287 return a10GB100GBCnt;
290 int32_t
291 getA100GB1TBCnt ()
293 return a100GB1TBCnt;
296 int32_t
297 getA1TB10TBCnt ()
299 return a1TB10TBCnt;
302 void setLeakStat (int64_t nb);
304 int64_t
305 getLSmallestBytes ()
307 return lSmallestBytes;
310 int64_t
311 getLLargestBytes ()
313 return lLargestBytes;
316 int32_t
317 getL0KB1KBCnt ()
319 return l0KB1KBCnt;
322 int32_t
323 getL1KB8KBCnt ()
325 return l1KB8KBCnt;
328 int32_t
329 getL8KB32KBCnt ()
331 return l8KB32KBCnt;
334 int32_t
335 getL32KB128KBCnt ()
337 return l32KB128KBCnt;
340 int32_t
341 getL128KB256KBCnt ()
343 return l128KB256KBCnt;
346 int32_t
347 getL256KB512KBCnt ()
349 return l256KB512KBCnt;
352 int32_t
353 getL512KB1000KBCnt ()
355 return l512KB1000KBCnt;
358 int32_t
359 getL1000KB10MBCnt ()
361 return l1000KB10MBCnt;
364 int32_t
365 getL10MB100MBCnt ()
367 return l10MB100MBCnt;
370 int32_t
371 getL100MB1GBCnt ()
373 return l100MB1GBCnt;
376 int32_t
377 getL1GB10GBCnt ()
379 return l1GB10GBCnt;
382 int32_t
383 getL10GB100GBCnt ()
385 return l10GB100GBCnt;
388 int32_t
389 getL100GB1TBCnt ()
391 return l100GB1TBCnt;
394 int32_t
395 getL1TB10TBCnt ()
397 return l1TB10TBCnt;
400 private:
401 char *stackName; // stack name
402 uint64_t allocBytes; // The total bytes allocated
403 uint64_t leakBytes; // The total bytes leaked
404 int32_t allocCnt; // The alloc count
405 int32_t leakCnt; // The leak count
406 Histable::Type histType; // The Histable type: HEAPCALLSTACK
407 int64_t peakMemUsage; // Keep track of peak memory usage
408 uint64_t stackId;
409 Vector<uint64_t> *peakStackIds; // The peak memory usage stack ids
410 hrtime_t timestamp;
411 Vector<hrtime_t> *peakTimestamps; // The peak data
412 int pid; // The process id
413 int userExpId; // The experiment id
415 int64_t aSmallestBytes;
416 int64_t aLargestBytes;
417 int32_t a0KB1KBCnt;
418 int32_t a1KB8KBCnt;
419 int32_t a8KB32KBCnt;
420 int32_t a32KB128KBCnt;
421 int32_t a128KB256KBCnt;
422 int32_t a256KB512KBCnt;
423 int32_t a512KB1000KBCnt;
424 int32_t a1000KB10MBCnt;
425 int32_t a10MB100MBCnt;
426 int32_t a100MB1GBCnt;
427 int32_t a1GB10GBCnt;
428 int32_t a10GB100GBCnt;
429 int32_t a100GB1TBCnt;
430 int32_t a1TB10TBCnt;
432 int64_t lSmallestBytes;
433 int64_t lLargestBytes;
434 int32_t l0KB1KBCnt;
435 int32_t l1KB8KBCnt;
436 int32_t l8KB32KBCnt;
437 int32_t l32KB128KBCnt;
438 int32_t l128KB256KBCnt;
439 int32_t l256KB512KBCnt;
440 int32_t l512KB1000KBCnt;
441 int32_t l1000KB10MBCnt;
442 int32_t l10MB100MBCnt;
443 int32_t l100MB1GBCnt;
444 int32_t l1GB10GBCnt;
445 int32_t l10GB100GBCnt;
446 int32_t l100GB1TBCnt;
447 int32_t l1TB10TBCnt;
450 #endif