void MemProfiler::do_trace() { // Calculate thread local sizes size_t handles_memory_usage = VMThread::vm_thread()->handle_area()->size_in_bytes(); size_t resource_memory_usage = VMThread::vm_thread()->resource_area()->size_in_bytes(); JavaThread *cur = Threads::first(); while (cur != NULL) { handles_memory_usage += cur->handle_area()->size_in_bytes(); resource_memory_usage += cur->resource_area()->size_in_bytes(); cur = cur->next(); } // Print trace line in log fprintf(_log_fp, "%6.1f,%5d,%5d," UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) ",", os::elapsedTime(), Threads::number_of_threads(), SystemDictionary::number_of_classes(), Universe::heap()->used() / K, Universe::heap()->capacity() / K); fprintf(_log_fp, UINTX_FORMAT_W(6) ",", CodeCache::capacity() / K); fprintf(_log_fp, UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) ",%6ld\n", handles_memory_usage / K, resource_memory_usage / K, OopMapCache::memory_usage() / K); fflush(_log_fp); }
void print(outputStream* st) { st->print("[ " UINTX_FORMAT_W(-25) " ... " UINTX_FORMAT_W(25) " ]", _min, _max); }
void Flag::print_on(outputStream* st, bool withComments, bool printRanges) { // Don't print notproduct and develop flags in a product build. if (is_constant_in_binary()) { return; } if (!printRanges) { st->print("%9s %-40s %c= ", _type, _name, (!is_default() ? ':' : ' ')); if (is_bool()) { st->print("%-16s", get_bool() ? "true" : "false"); } else if (is_int()) { st->print("%-16d", get_int()); } else if (is_uint()) { st->print("%-16u", get_uint()); } else if (is_intx()) { st->print(INTX_FORMAT_W(-16), get_intx()); } else if (is_uintx()) { st->print(UINTX_FORMAT_W(-16), get_uintx()); } else if (is_uint64_t()) { st->print(UINT64_FORMAT_W(-16), get_uint64_t()); } else if (is_size_t()) { st->print(SIZE_FORMAT_W(-16), get_size_t()); } else if (is_double()) { st->print("%-16f", get_double()); } else if (is_ccstr()) { const char* cp = get_ccstr(); if (cp != NULL) { const char* eol; while ((eol = strchr(cp, '\n')) != NULL) { size_t llen = pointer_delta(eol, cp, sizeof(char)); st->print("%.*s", (int)llen, cp); st->cr(); cp = eol+1; st->print("%5s %-35s += ", "", _name); } st->print("%-16s", cp); } else st->print("%-16s", ""); } st->print("%-20s", " "); print_kind(st); #ifndef PRODUCT if (withComments) { st->print("%s", _doc); } #endif st->cr(); } else if (!is_bool() && !is_ccstr()) { if (printRanges) { st->print("%9s %-50s ", _type, _name); CommandLineFlagRangeList::print(_name, st, true); st->print(" %-20s", " "); print_kind(st); #ifndef PRODUCT if (withComments) { st->print("%s", _doc); } #endif st->cr(); } } }