8148630: Convert TraceStartupTime to Unified Logging

The former -XX:+TraceStartupTime flag has been converted to the UL option -Xlog:startuptime=info

Reviewed-by: coleenp, dholmes
This commit is contained in:
Rachel Protacio 2016-02-17 14:03:18 -05:00
parent c867b023b6
commit 92f9c27eec
14 changed files with 242 additions and 107 deletions

View file

@ -1482,9 +1482,6 @@ public:
develop(bool, TraceCompiledIC, false, \
"Trace changes of compiled IC") \
\
develop(bool, TraceStartupTime, false, \
"Trace setup time") \
\
develop(bool, TraceProtectionDomainVerification, false, \
"Trace protection domain verification") \
\

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_RUNTIME_LOG_TIMER_HPP
#define SHARE_VM_RUNTIME_LOG_TIMER_HPP
#include "logging/log.hpp"
#include "runtime/timer.hpp"
// TraceStartupTime is used for tracing the execution time of a block with logging
// Usage:
// { TraceStartupTime t("block time")
// some_code();
// }
//
class TraceStartupTime : public TraceTime {
public:
TraceStartupTime(const char* s) : TraceTime(s, log_is_enabled(Info, startuptime), LogTag::_startuptime) {}
};
#endif // SHARE_VM_RUNTIME_LOG_TIMER_HPP

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,9 +28,9 @@
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/logTimer.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/timer.hpp"
#include "utilities/copy.hpp"
#ifdef COMPILER2
#include "opto/runtime.hpp"
@ -183,7 +183,7 @@ extern void StubGenerator_generate(CodeBuffer* code, bool all); // only interfac
void StubRoutines::initialize1() {
if (_code1 == NULL) {
ResourceMark rm;
TraceTime timer("StubRoutines generation 1", TraceStartupTime);
TraceStartupTime timer("StubRoutines generation 1");
_code1 = BufferBlob::create("StubRoutines (1)", code_size1);
if (_code1 == NULL) {
vm_exit_out_of_memory(code_size1, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (1)");
@ -276,7 +276,7 @@ static void test_safefetchN() {
void StubRoutines::initialize2() {
if (_code2 == NULL) {
ResourceMark rm;
TraceTime timer("StubRoutines generation 2", TraceStartupTime);
TraceStartupTime timer("StubRoutines generation 2");
_code2 = BufferBlob::create("StubRoutines (2)", code_size2);
if (_code2 == NULL) {
vm_exit_out_of_memory(code_size2, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (2)");

View file

@ -67,6 +67,7 @@
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jniPeriodicChecker.hpp"
#include "runtime/logTimer.hpp"
#include "runtime/memprofiler.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
@ -3341,7 +3342,7 @@ void Threads::threads_do(ThreadClosure* tc) {
}
void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
TraceTime timer("Initialize java.lang classes", TraceStartupTime);
TraceStartupTime timer("Initialize java.lang classes");
if (EagerXrunInit && Arguments::init_libraries_at_startup()) {
create_vm_init_libraries();
@ -3388,6 +3389,8 @@ void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
}
void Threads::initialize_jsr292_core_classes(TRAPS) {
TraceStartupTime timer("Initialize java.lang.invoke classes");
initialize_class(vmSymbols::java_lang_invoke_MethodHandle(), CHECK);
initialize_class(vmSymbols::java_lang_invoke_MemberName(), CHECK);
initialize_class(vmSymbols::java_lang_invoke_MethodHandleNatives(), CHECK);
@ -3457,7 +3460,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
HOTSPOT_VM_INIT_BEGIN();
// Timing (must come after argument parsing)
TraceTime timer("Create VM", TraceStartupTime);
TraceStartupTime timer("Create VM");
// Initialize the os module after parsing the args
jint os_init_2_result = os::init_2();
@ -3542,8 +3545,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
JvmtiExport::transition_pending_onload_raw_monitors();
// Create the VMThread
{ TraceTime timer("Start VMThread", TraceStartupTime);
VMThread::create();
{ TraceStartupTime timer("Start VMThread");
VMThread::create();
Thread* vmthread = VMThread::vm_thread();
if (!os::create_thread(vmthread, os::vm_thread)) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "logging/log.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/timer.hpp"
#include "utilities/ostream.hpp"
@ -114,14 +115,15 @@ jlong TimeStamp::ticks_since_update() const {
}
TraceTime::TraceTime(const char* title,
bool doit) {
bool doit,
LogTagType tag) {
_active = doit;
_verbose = true;
_tag = tag;
_title = title;
if (_active) {
_accum = NULL;
tty->print("[%s", title);
tty->flush();
_t.start();
}
}
@ -129,14 +131,14 @@ TraceTime::TraceTime(const char* title,
TraceTime::TraceTime(const char* title,
elapsedTimer* accumulator,
bool doit,
bool verbose) {
_active = doit;
_verbose = verbose;
bool verbose,
LogTagType tag) {
_active = doit;
_verbose = verbose;
_tag = tag;
_title = title;
if (_active) {
if (_verbose) {
tty->print("[%s", title);
tty->flush();
}
_accum = accumulator;
_t.start();
}
@ -147,8 +149,15 @@ TraceTime::~TraceTime() {
_t.stop();
if (_accum!=NULL) _accum->add(_t);
if (_verbose) {
tty->print_cr(", %3.7f secs]", _t.seconds());
tty->flush();
switch (_tag) {
case LogTag::_startuptime :
log_info(startuptime)("%s, %3.7f secs", _title, _t.seconds());
break;
case LogTag::__NO_TAG :
default :
tty->print_cr("[%s, %3.7f secs]", _title, _t.seconds());
tty->flush();
}
}
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
#ifndef SHARE_VM_RUNTIME_TIMER_HPP
#define SHARE_VM_RUNTIME_TIMER_HPP
#include "logging/logTag.hpp"
#include "utilities/globalDefinitions.hpp"
// Timers for simple measurement.
@ -85,14 +86,19 @@ class TraceTime: public StackObj {
bool _verbose; // report every timing
elapsedTimer _t; // timer
elapsedTimer* _accum; // accumulator
const char* _title; // name of timer
LogTagType _tag; // stream to print to
public:
// Constructors
TraceTime(const char* title,
bool doit = true);
bool doit = true,
LogTagType tag = LogTag::__NO_TAG);
TraceTime(const char* title,
elapsedTimer* accumulator,
bool doit = true,
bool verbose = false);
bool verbose = false,
LogTagType tag = LogTag::__NO_TAG);
~TraceTime();
// Accessors