8168122: Update logging in perfMemory to Unified Logging
authorrprotacio
Mon, 24 Apr 2017 11:32:38 -0400
changeset 46405 17ab5460b2cb
parent 46403 f2b91b928476
child 46406 42db25fd251f
8168122: Update logging in perfMemory to Unified Logging Summary: -XX:+PerfTraceMemOps replaced with -Xlog:perf+memops=debug, -XX:+PerfTraceDataCreation replaced with -Xlog:perf+datacreation=debug Reviewed-by: sspitsyn, coleenp
hotspot/src/os/aix/vm/perfMemory_aix.cpp
hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
hotspot/src/os/linux/vm/perfMemory_linux.cpp
hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
hotspot/src/os/windows/vm/perfMemory_windows.cpp
hotspot/src/share/vm/logging/logTag.hpp
hotspot/src/share/vm/runtime/globals.hpp
hotspot/src/share/vm/runtime/perfData.cpp
hotspot/src/share/vm/runtime/perfMemory.cpp
--- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp	Mon Apr 24 11:32:38 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -25,6 +25,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
@@ -1244,15 +1245,10 @@
   *addr = mapAddress;
   *sizep = size;
 
-  if (PerfTraceMemOps) {
-    tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
-  }
+  log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at "
+                          INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
 }
 
-
-
-
 // create the PerfData memory region
 //
 // This method creates the memory region used to store performance
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Mon Apr 24 11:32:38 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
@@ -1150,15 +1151,10 @@
   *addr = mapAddress;
   *sizep = size;
 
-  if (PerfTraceMemOps) {
-    tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
-  }
+  log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at "
+                          INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
 }
 
-
-
-
 // create the PerfData memory region
 //
 // This method creates the memory region used to store performance
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Mon Apr 24 11:32:38 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
@@ -1166,15 +1167,10 @@
   *addr = mapAddress;
   *sizep = size;
 
-  if (PerfTraceMemOps) {
-    tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
-  }
+  log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at "
+                          INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
 }
 
-
-
-
 // create the PerfData memory region
 //
 // This method creates the memory region used to store performance
--- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp	Mon Apr 24 11:32:38 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
@@ -1184,15 +1185,10 @@
   *addr = mapAddress;
   *sizep = size;
 
-  if (PerfTraceMemOps) {
-    tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
-  }
+  log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at "
+                          INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
 }
 
-
-
-
 // create the PerfData memory region
 //
 // This method creates the memory region used to store performance
--- a/hotspot/src/os/windows/vm/perfMemory_windows.cpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/os/windows/vm/perfMemory_windows.cpp	Mon Apr 24 11:32:38 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
@@ -1695,10 +1696,8 @@
   // invalidating the mapped view of the file
   CloseHandle(fmh);
 
-  if (PerfTraceMemOps) {
-    tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, mapAddress);
-  }
+  log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at "
+                          INTPTR_FORMAT "\n", size, vmid, mapAddress);
 }
 
 // this method unmaps the the mapped view of the the
--- a/hotspot/src/share/vm/logging/logTag.hpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/share/vm/logging/logTag.hpp	Mon Apr 24 11:32:38 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -57,6 +57,7 @@
   LOG_TAG(cpu) \
   LOG_TAG(cset) \
   LOG_TAG(data) \
+  LOG_TAG(datacreation) \
   LOG_TAG(defaultmethods) \
   LOG_TAG(dump) \
   LOG_TAG(ergo) \
@@ -82,6 +83,7 @@
   LOG_TAG(logging) \
   LOG_TAG(mark) \
   LOG_TAG(marking) \
+  LOG_TAG(memops) \
   LOG_TAG(methodcomparator) \
   LOG_TAG(metadata) \
   LOG_TAG(metaspace) \
@@ -98,6 +100,7 @@
   LOG_TAG(pagesize) \
   LOG_TAG(patch) \
   LOG_TAG(path) \
+  LOG_TAG(perf) \
   LOG_TAG(phases) \
   LOG_TAG(plab) \
   LOG_TAG(promotion) \
--- a/hotspot/src/share/vm/runtime/globals.hpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon Apr 24 11:32:38 2017 -0400
@@ -3811,12 +3811,6 @@
           range(PeriodicTask::min_interval, max_jint)                       \
           constraint(PerfDataSamplingIntervalFunc, AfterErgo)               \
                                                                             \
-  develop(bool, PerfTraceDataCreation, false,                               \
-          "Trace creation of Performance Data Entries")                     \
-                                                                            \
-  develop(bool, PerfTraceMemOps, false,                                     \
-          "Trace PerfMemory create/attach/detach calls")                    \
-                                                                            \
   product(bool, PerfDisableSharedMem, false,                                \
           "Store performance data in standard memory")                      \
                                                                             \
--- a/hotspot/src/share/vm/runtime/perfData.cpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/share/vm/runtime/perfData.cpp	Mon Apr 24 11:32:38 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
@@ -166,17 +167,15 @@
   pdep->flags = (jbyte)flags();
   pdep->data_offset = (jint) data_start;
 
-  if (PerfTraceDataCreation) {
-    tty->print("name = %s, dtype = %d, variability = %d,"
-               " units = %d, dsize = " SIZE_FORMAT ", vlen = " SIZE_FORMAT ","
-               " pad_length = " SIZE_FORMAT ", size = " SIZE_FORMAT ", on_c_heap = %s,"
-               " address = " INTPTR_FORMAT ","
-               " data address = " INTPTR_FORMAT "\n",
-               cname, dtype, variability(),
-               units(), dsize, vlen,
-               pad_length, size, is_on_c_heap() ? "TRUE":"FALSE",
-               p2i(psmp), p2i(valuep));
-  }
+  log_debug(perf, datacreation)("name = %s, dtype = %d, variability = %d,"
+                                " units = %d, dsize = " SIZE_FORMAT ", vlen = " SIZE_FORMAT ","
+                                " pad_length = " SIZE_FORMAT ", size = " SIZE_FORMAT ", on_c_heap = %s,"
+                                " address = " INTPTR_FORMAT ","
+                                " data address = " INTPTR_FORMAT "\n",
+                                cname, dtype, variability(),
+                                units(), dsize, vlen,
+                                pad_length, size, is_on_c_heap() ? "TRUE":"FALSE",
+                                p2i(psmp), p2i(valuep));
 
   // record the start of the entry and the location of the data field.
   _pdep = pdep;
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp	Mon Apr 24 08:47:38 2017 -0400
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp	Mon Apr 24 11:32:38 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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 "memory/allocation.inline.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/java.hpp"
@@ -92,14 +93,12 @@
   size_t capacity = align_size_up(PerfDataMemorySize,
                                   os::vm_allocation_granularity());
 
-  if (PerfTraceMemOps) {
-    tty->print("PerfDataMemorySize = " SIZE_FORMAT ","
-               " os::vm_allocation_granularity = %d,"
-               " adjusted size = " SIZE_FORMAT "\n",
-               PerfDataMemorySize,
-               os::vm_allocation_granularity(),
-               capacity);
-  }
+  log_debug(perf, memops)("PerfDataMemorySize = " SIZE_FORMAT ","
+                          " os::vm_allocation_granularity = %d,"
+                          " adjusted size = " SIZE_FORMAT "\n",
+                          PerfDataMemorySize,
+                          os::vm_allocation_granularity(),
+                          capacity);
 
   // allocate PerfData memory region
   create_memory_region(capacity);
@@ -124,12 +123,10 @@
 
     // the PerfMemory region was created as expected.
 
-    if (PerfTraceMemOps) {
-      tty->print("PerfMemory created: address = " INTPTR_FORMAT ","
-                 " size = " SIZE_FORMAT "\n",
-                 p2i(_start),
-                 _capacity);
-    }
+    log_debug(perf, memops)("PerfMemory created: address = " INTPTR_FORMAT ","
+                            " size = " SIZE_FORMAT "\n",
+                            p2i(_start),
+                            _capacity);
 
     _prologue = (PerfDataPrologue *)_start;
     _end = _start + _capacity;