Mercurial > hg > release > heapstats-1.1
changeset 23:51762fe6dc8e
Bug 1844: Agent should be adapted new HotSpot versioning: JDK-8030011
reviewed-by: ykubota
author | Yasumasa Suenaga <yasuenag@gmail.com> |
---|---|
date | Tue, 17 Jun 2014 23:22:44 +0900 |
parents | 8448fe8f7fae |
children | a3d52921b48f |
files | agent/ChangeLog agent/src/oopUtil.cpp |
diffstat | 2 files changed, 48 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/ChangeLog Mon Apr 14 22:23:10 2014 +0900 +++ b/agent/ChangeLog Tue Jun 17 23:22:44 2014 +0900 @@ -1,3 +1,7 @@ +2014-06-17 Yasumasa Suenaga <yasuenag@gmail.com> + + * Bug 1844: Agent should be adapted new HotSpot versioning: JDK-8030011 + 2014-04-19 Yasumasa Suenaga <yasuenag@gmail.com> * Bug 1735: REGRESSION: Cannot collect files from procfs
--- a/agent/src/oopUtil.cpp Mon Apr 14 22:23:10 2014 +0900 +++ b/agent/src/oopUtil.cpp Tue Jun 17 23:22:44 2014 +0900 @@ -2757,19 +2757,54 @@ } else { unsigned char major = 0; unsigned char minor = 0; - unsigned short build = 0; + unsigned char build = 0; int result = 0; /* Parse version string. */ - result = sscanf(versionStr, "%hhu.%hhu-b%hu", &major, &minor, &build); + result = sscanf(versionStr, "%hhu.%hhu-b%hhu", + &major, &minor, &build); + /* + * We expect to get 3 values (major, minor, build) from sscanf() + * at first. + */ + if(result == 3){ + hotSpotVersion = major << 24 | minor << 16 | build; + } + else{ + /* After JDK-8030011: Update Hotspot version string output */ + unsigned short micro = 0; + result = sscanf(versionStr, "%hhu.%hhu.%hhu", + &major, &minor, µ); + char *build_str = strrchr(versionStr, 'b'); + if(likely(build_str != NULL)){ + result += sscanf(build_str, "b%hhu", &build); + } + + /* + * We expect to get 4 values (major, minor, micro, build) + * from sscanf(). + * This versioning equals to JDK version. + */ + if (unlikely(result != 4)) { + PRINT_CRIT_MSG_HEADER << "Unsupported JVM version: " + << versionStr + << " (" << result << ")" + << NEWLINE; + + jvmti->Deallocate((unsigned char *)versionStr); + throw 1; + } + + /* + * Latest HS version is "25". + * So I add 25 to major. + */ + major += 25; + + hotSpotVersion = major << 24 | minor << 16 | micro << 8 | build; + } + jvmti->Deallocate((unsigned char *)versionStr); - - /* If failure parse version string. */ - if (unlikely(result != 3)) { - PRINT_CRIT_MSG("Unsupported JVM version."); - throw 1; - } - hotSpotVersion = major << 24 | minor << 16 | build; } /*