Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get hashCode from JLM #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion perf-tool/src/agentOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ void modifyJLM(const std::string& function, const std::string& command)
auto javaMonitors = json::array();
auto rawMonitors = json::array();
char *crt = dump->begin + dumpOffset;
char str[32];
jint hash;
while(crt < dump->end)
{
if ((*crt) & (JVMTI_MONITOR_JAVA | JVMTI_MONITOR_RAW))
Expand Down Expand Up @@ -360,6 +362,10 @@ void modifyJLM(const std::string& function, const std::string& command)
crt += sizeof(uint64_t);
jMon["monitorName"] = crt;
crt += strlen(crt) + 1;
hash = h2n.convert(*(uint32_t*)crt);
sprintf(str, "0x%x", hash);
jMon["monitorHash"] = str;
crt += sizeof(uint32_t);
if (monType & JVMTI_MONITOR_JAVA)
javaMonitors.push_back(jMon);
else
Expand All @@ -369,7 +375,7 @@ void modifyJLM(const std::string& function, const std::string& command)
{
int monNameDistance = 2*sizeof(char) + 5*sizeof(uint32_t) + 2*sizeof(uint64_t);
char *monName = crt + monNameDistance;
crt += monNameDistance + strlen(monName) + 1;
crt += monNameDistance + strlen(monName) + 1 + sizeof(uint32_t);
}
}
jvmti->Deallocate((unsigned char*)dump);
Expand Down