forked from dcapwell/lightweight-java-profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.h
46 lines (31 loc) · 1.06 KB
/
display.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <jvmti.h>
#include <stdio.h>
#include <string>
#include "globals.h"
#include "profiler.h"
#ifndef DISPLAY_H
#define DISPLAY_H
// Some platforms have a ::string class that is different from ::std::string
// (although the interface is the same, of course). On other platforms,
// ::string is the same as ::std::string.
#ifndef HAS_GLOBAL_STRING
using std::string;
#endif
class StackTracesPrinter {
public:
StackTracesPrinter(FILE *file, jvmtiEnv *jvmti)
: file_(file), jvmti_(jvmti) {}
void PrintStackTraces(TraceData *traces, int length);
void PrintLeafHistogram(TraceData *traces, int length);
private:
FILE *file_;
jvmtiEnv *jvmti_;
bool PrintStackFrame(JVMPI_CallFrame *frame);
void PrintStackTrace(TraceData *trace);
bool GetStackFrameElements(JVMPI_CallFrame *frame, string *method_name,
string *class_name, string *file_name,
int *line_number);
jint GetLineNumber(jmethodID method, jlocation location);
DISALLOW_COPY_AND_ASSIGN(StackTracesPrinter);
};
#endif // DISPLAY_H