1 /*
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "classfile/classLoaderStats.hpp"
29 #include "classfile/javaClasses.hpp"
30 #include "code/codeCache.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "gc/g1/g1HeapRegionEventSender.hpp"
33 #include "gc/shared/gcConfiguration.hpp"
34 #include "gc/shared/gcTrace.hpp"
35 #include "gc/shared/gcVMOperations.hpp"
36 #include "gc/shared/objectCountEventSender.hpp"
37 #include "jfr/jfrEvents.hpp"
38 #include "jfr/periodic/jfrModuleEvent.hpp"
39 #include "jfr/periodic/jfrOSInterface.hpp"
40 #include "jfr/periodic/jfrThreadCPULoadEvent.hpp"
41 #include "jfr/periodic/jfrThreadDumpEvent.hpp"
42 #include "jfr/periodic/jfrNetworkUtilization.hpp"
43 #include "jfr/recorder/jfrRecorder.hpp"
44 #include "jfr/support/jfrThreadId.hpp"
45 #include "jfr/utilities/jfrTime.hpp"
46 #include "jfrfiles/jfrPeriodic.hpp"
47 #include "logging/log.hpp"
48 #include "memory/heapInspection.hpp"
49 #include "memory/resourceArea.hpp"
489 _stats->iterate(this);
490 }
491 };
492
493 class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation {
494 public:
495 JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { }
496
497 void doit() {
498 JfrClassLoaderStatsClosure clsc;
499 ClassLoaderDataGraph::loaded_cld_do(&clsc);
500 clsc.createEvents();
501 }
502 };
503
504 TRACE_REQUEST_FUNC(ClassLoaderStatistics) {
505 JfrClassLoaderStatsVMOperation op;
506 VMThread::execute(&op);
507 }
508
509 TRACE_REQUEST_FUNC(CompilerStatistics) {
510 EventCompilerStatistics event;
511 event.set_compileCount(CompileBroker::get_total_compile_count());
512 event.set_bailoutCount(CompileBroker::get_total_bailout_count());
513 event.set_invalidatedCount(CompileBroker::get_total_invalidated_count());
514 event.set_osrCompileCount(CompileBroker::get_total_osr_compile_count());
515 event.set_standardCompileCount(CompileBroker::get_total_standard_compile_count());
516 event.set_osrBytesCompiled(CompileBroker::get_sum_osr_bytes_compiled());
517 event.set_standardBytesCompiled(CompileBroker::get_sum_standard_bytes_compiled());
518 event.set_nmetodsSize(CompileBroker::get_sum_nmethod_size());
519 event.set_nmetodCodeSize(CompileBroker::get_sum_nmethod_code_size());
520 event.set_peakTimeSpent(CompileBroker::get_peak_compilation_time());
521 event.set_totalTimeSpent(CompileBroker::get_total_compilation_time());
522 event.commit();
523 }
524
525 TRACE_REQUEST_FUNC(CompilerConfiguration) {
526 EventCompilerConfiguration event;
527 event.set_threadCount(CICompilerCount);
528 event.set_tieredCompilation(TieredCompilation);
|
1 /*
2 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "classfile/classLoaderStats.hpp"
29 #include "classfile/javaClasses.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/symbolTable.hpp"
32 #include "classfile/systemDictionary.hpp"
33 #include "code/codeCache.hpp"
34 #include "compiler/compileBroker.hpp"
35 #include "gc/g1/g1HeapRegionEventSender.hpp"
36 #include "gc/shared/gcConfiguration.hpp"
37 #include "gc/shared/gcTrace.hpp"
38 #include "gc/shared/gcVMOperations.hpp"
39 #include "gc/shared/objectCountEventSender.hpp"
40 #include "jfr/jfrEvents.hpp"
41 #include "jfr/periodic/jfrModuleEvent.hpp"
42 #include "jfr/periodic/jfrOSInterface.hpp"
43 #include "jfr/periodic/jfrThreadCPULoadEvent.hpp"
44 #include "jfr/periodic/jfrThreadDumpEvent.hpp"
45 #include "jfr/periodic/jfrNetworkUtilization.hpp"
46 #include "jfr/recorder/jfrRecorder.hpp"
47 #include "jfr/support/jfrThreadId.hpp"
48 #include "jfr/utilities/jfrTime.hpp"
49 #include "jfrfiles/jfrPeriodic.hpp"
50 #include "logging/log.hpp"
51 #include "memory/heapInspection.hpp"
52 #include "memory/resourceArea.hpp"
492 _stats->iterate(this);
493 }
494 };
495
496 class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation {
497 public:
498 JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { }
499
500 void doit() {
501 JfrClassLoaderStatsClosure clsc;
502 ClassLoaderDataGraph::loaded_cld_do(&clsc);
503 clsc.createEvents();
504 }
505 };
506
507 TRACE_REQUEST_FUNC(ClassLoaderStatistics) {
508 JfrClassLoaderStatsVMOperation op;
509 VMThread::execute(&op);
510 }
511
512 #define FILL_TABLE_EVENT(event, statistics) \
513 ({ \
514 event.set_bucketCount(statistics._number_of_buckets); \
515 event.set_entryCount(statistics._number_of_entries); \
516 event.set_totalFootprint(statistics._total_footprint); \
517 event.set_maximumBucketCount(statistics._maximum_bucket_size); \
518 event.set_averageBucketCount(statistics._average_bucket_size); \
519 event.set_varianceOfBucketCount(statistics._variance_of_bucket_size); \
520 event.set_stdDevOfBucketCount(statistics._stddev_of_bucket_size); \
521 event.set_insertionRate(statistics._add_rate); \
522 event.set_removalRate(statistics._remove_rate); \
523 })
524
525 TRACE_REQUEST_FUNC(SymbolTableStatistics) {
526 SymbolTable *table = SymbolTable::the_table();
527 TableStatistics statistics = table->get_table_statistics();
528 if (statistics._owned) {
529 //statistics.print(tty, "SymbolTable");
530 EventSymbolTableStatistics event;
531 FILL_TABLE_EVENT(event, statistics);
532 event.commit();
533 }
534 }
535
536 TRACE_REQUEST_FUNC(StringTableStatistics) {
537 StringTable *table = StringTable::the_table();
538 TableStatistics statistics = table->get_table_statistics();
539 if (statistics._owned) {
540 //statistics.print(tty, "StringTable");
541 EventStringTableStatistics event;
542 FILL_TABLE_EVENT(event, statistics);
543 event.commit();
544 }
545 }
546
547 TRACE_REQUEST_FUNC(PlaceholderTableStatistics) {
548 TableStatistics statistics = SystemDictionary::placeholders_statistics();
549 if (statistics._owned) {
550 //statistics.print(tty, "PlaceholderTable");
551 EventPlaceholderTableStatistics event;
552 FILL_TABLE_EVENT(event, statistics);
553 event.commit();
554 }
555 }
556
557 TRACE_REQUEST_FUNC(LoaderConstraintsTableStatistics) {
558 TableStatistics statistics = SystemDictionary::loader_constraints_statistics();
559 if (statistics._owned) {
560 //statistics.print(tty, "LoaderConstraintsTable");
561 EventLoaderConstraintsTableStatistics event;
562 FILL_TABLE_EVENT(event, statistics);
563 event.commit();
564 }
565 }
566
567 TRACE_REQUEST_FUNC(ProtectionDomainCacheTableStatistics) {
568 TableStatistics statistics = SystemDictionary::protection_domain_cache_statistics();
569 if (statistics._owned) {
570 //statistics.print(tty, "ProtectionDomainCacheTable");
571 EventProtectionDomainCacheTableStatistics event;
572 FILL_TABLE_EVENT(event, statistics);
573 event.commit();
574 }
575 }
576
577 TRACE_REQUEST_FUNC(CompilerStatistics) {
578 EventCompilerStatistics event;
579 event.set_compileCount(CompileBroker::get_total_compile_count());
580 event.set_bailoutCount(CompileBroker::get_total_bailout_count());
581 event.set_invalidatedCount(CompileBroker::get_total_invalidated_count());
582 event.set_osrCompileCount(CompileBroker::get_total_osr_compile_count());
583 event.set_standardCompileCount(CompileBroker::get_total_standard_compile_count());
584 event.set_osrBytesCompiled(CompileBroker::get_sum_osr_bytes_compiled());
585 event.set_standardBytesCompiled(CompileBroker::get_sum_standard_bytes_compiled());
586 event.set_nmetodsSize(CompileBroker::get_sum_nmethod_size());
587 event.set_nmetodCodeSize(CompileBroker::get_sum_nmethod_code_size());
588 event.set_peakTimeSpent(CompileBroker::get_peak_compilation_time());
589 event.set_totalTimeSpent(CompileBroker::get_total_compilation_time());
590 event.commit();
591 }
592
593 TRACE_REQUEST_FUNC(CompilerConfiguration) {
594 EventCompilerConfiguration event;
595 event.set_threadCount(CICompilerCount);
596 event.set_tieredCompilation(TieredCompilation);
|