1 /* Copyright (C) 2021 Free Software Foundation, Inc.
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)
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. */
28 #include "data_pckts.h"
31 #define TOTAL_HEAPNAME NTXT("<Total>")
32 #define TOTAL_STACK_ID 0
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;
52 HeapData (char *sName);
53 HeapData (HeapData *hData);
55 char *get_raw_name (Histable::NameFormat nfmt);
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);
89 addAllocEvent (uint64_t nb)
108 addLeakEvent (uint64_t nb)
127 setStackId (uint64_t sId)
139 setTimestamp (hrtime_t ts)
151 setHistType (Histable::Type hType)
177 return peakTimestamps;
193 setUserExpId (int uei)
204 void setAllocStat (int64_t nb);
209 return aSmallestBytes;
215 return aLargestBytes;
239 return a32KB128KBCnt;
245 return a128KB256KBCnt;
251 return a256KB512KBCnt;
255 getA512KB1000KBCnt ()
257 return a512KB1000KBCnt;
263 return a1000KB10MBCnt;
269 return a10MB100MBCnt;
287 return a10GB100GBCnt;
302 void setLeakStat (int64_t nb);
307 return lSmallestBytes;
313 return lLargestBytes;
337 return l32KB128KBCnt;
343 return l128KB256KBCnt;
349 return l256KB512KBCnt;
353 getL512KB1000KBCnt ()
355 return l512KB1000KBCnt;
361 return l1000KB10MBCnt;
367 return l10MB100MBCnt;
385 return l10GB100GBCnt;
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
409 Vector<uint64_t> *peakStackIds; // The peak memory usage stack ids
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;
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;
428 int32_t a10GB100GBCnt;
429 int32_t a100GB1TBCnt;
432 int64_t lSmallestBytes;
433 int64_t lLargestBytes;
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;
445 int32_t l10GB100GBCnt;
446 int32_t l100GB1TBCnt;