MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / resolveMethod

Method resolveMethod

src/lookup.cpp:45–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45MethodInfo* Lookup::resolveMethod(ASGCT_CallFrame& frame) {
46 jmethodID method = frame.method_id;
47 MethodInfo* mi = &(*_method_map)[method];
48
49 bool first_time = mi->_key == 0;
50 if (first_time) {
51 mi->_key = _method_map->size();
52 }
53
54 if (!mi->_mark) {
55 mi->_mark = true;
56 if (method == NULL) {
57 fillNativeMethodInfo(mi, "unknown", NULL);
58 } else if (frame.bci > BCI_NATIVE_FRAME) {
59 if (!fillJavaMethodInfo(mi, method, first_time)) {
60 fillNativeMethodInfo(mi, "stale_jmethodID", NULL);
61 }
62 } else if (frame.bci == BCI_NATIVE_FRAME) {
63 const char* name = (const char*)method;
64 fillNativeMethodInfo(mi, name, Profiler::instance()->getLibraryName(name));
65 } else if (frame.bci == BCI_ADDRESS) {
66 char buf[32];
67 snprintf(buf, sizeof(buf), "%p", method);
68 fillNativeMethodInfo(mi, buf, NULL);
69 } else if (frame.bci == BCI_ERROR) {
70 fillNativeMethodInfo(mi, (const char*)method, NULL);
71 } else if (frame.bci == BCI_CPU) {
72 char buf[32];
73 snprintf(buf, sizeof(buf), "CPU-%d", ((int)(uintptr_t)method) & 0x7fff);
74 fillNativeMethodInfo(mi, buf, NULL);
75 } else {
76 fillJavaClassInfo(mi, (uintptr_t)method);
77 }
78 }
79
80 return mi;
81}
82
83u32 Lookup::getPackage(const char* class_name) {
84 assert(_packages != nullptr);

Callers 1

writeStackTracesMethod · 0.80

Calls 2

getLibraryNameMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected