Link conv-cpm as C++
[charm.git] / src / ck-perf / trace-memory.h
blob637c6c49833655a79d01b533f4075d3ab07fe06c
1 #ifndef __TRACE_MEMORY_H__
2 #define __TRACE_MEMORY_H__
4 #include "charm++.h"
5 #include "trace.h"
6 #include "trace-common.h"
7 #include <errno.h>
9 /** A representant of a memory operation */
11 class MemEntry {
12 friend class TraceMemory;
13 private:
14 int type;
15 void *where;
16 int size;
17 int stackSize;
19 public:
20 MemEntry();
21 void write(FILE *fp);
22 void set(int t, void *w, int s) {
23 type = t;
24 where = w;
25 size = s;
26 stackSize = 0;
28 void setStack(int ss, void **s) {
29 stackSize = ss;
30 memcpy(this+1, s, ss*sizeof(void*));
34 /**
35 class to trace all memory related events. Currently works only in conjunction
36 with "-memory charmdebug".
38 class TraceMemory : public Trace {
39 private:
40 bool firstTime;
41 bool recordStack;
42 bool traceDisabled;
43 int logBufSize;
44 int usedBuffer;
45 char *logBuffer;
47 void checkFlush(int add);
48 void flush();
49 public:
50 TraceMemory(char **argv);
52 void traceBegin();
53 void traceClose();
54 void malloc(void *where, int size, void **stack, int stackSize);
55 void free(void *where, int size);
58 #endif