--- old/src/share/vm/gc/shared/gcId.cpp 2015-11-19 15:35:19.906128821 +0100 +++ new/src/share/vm/gc/shared/gcId.cpp 2015-11-19 15:35:19.790128825 +0100 @@ -26,6 +26,7 @@ #include "gc/shared/gcId.hpp" #include "runtime/safepoint.hpp" #include "runtime/thread.inline.hpp" +#include "runtime/threadLocalStorage.hpp" uint GCId::_next_id = 0; @@ -47,6 +48,19 @@ return currentNamedthread()->gc_id(); } +size_t GCId::print_prefix(char* buf, size_t len) { + Thread* thread = ThreadLocalStorage::thread(); + if (thread != NULL && thread->is_Named_thread()) { + uint gc_id = current_raw(); + if (gc_id != undefined()) { + int ret = jio_snprintf(buf, len, "GC(%u) ", gc_id); + assert(ret > 0, "Failed to print prefix. Log buffer too small?"); + return (size_t)ret; + } + } + return 0; +} + GCIdMark::GCIdMark() : _gc_id(GCId::create()) { currentNamedthread()->set_gc_id(_gc_id); }