Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp
41149 views
1
/*
2
* Copyright (c) 2012, 2021, 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/shared/gcConfiguration.hpp"
36
#include "gc/shared/gcTrace.hpp"
37
#include "gc/shared/gcVMOperations.hpp"
38
#include "gc/shared/objectCountEventSender.hpp"
39
#include "jfr/jfrEvents.hpp"
40
#include "jfr/periodic/jfrModuleEvent.hpp"
41
#include "jfr/periodic/jfrOSInterface.hpp"
42
#include "jfr/periodic/jfrThreadCPULoadEvent.hpp"
43
#include "jfr/periodic/jfrThreadDumpEvent.hpp"
44
#include "jfr/periodic/jfrNetworkUtilization.hpp"
45
#include "jfr/recorder/jfrRecorder.hpp"
46
#include "jfr/support/jfrThreadId.hpp"
47
#include "jfr/utilities/jfrThreadIterator.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"
53
#include "oops/oop.inline.hpp"
54
#include "runtime/arguments.hpp"
55
#include "runtime/flags/jvmFlag.hpp"
56
#include "runtime/globals.hpp"
57
#include "runtime/interfaceSupport.inline.hpp"
58
#include "runtime/os.hpp"
59
#include "runtime/os_perf.hpp"
60
#include "runtime/thread.inline.hpp"
61
#include "runtime/sweeper.hpp"
62
#include "runtime/vmThread.hpp"
63
#include "runtime/vm_version.hpp"
64
#include "services/classLoadingService.hpp"
65
#include "services/management.hpp"
66
#include "services/threadService.hpp"
67
#include "utilities/exceptions.hpp"
68
#include "utilities/globalDefinitions.hpp"
69
#if INCLUDE_G1GC
70
#include "gc/g1/g1HeapRegionEventSender.hpp"
71
#endif
72
#if INCLUDE_SHENANDOAHGC
73
#include "gc/shenandoah/shenandoahJfrSupport.hpp"
74
#endif
75
/**
76
* JfrPeriodic class
77
* Implementation of declarations in
78
* xsl generated traceRequestables.hpp
79
*/
80
#define TRACE_REQUEST_FUNC(id) void JfrPeriodicEventSet::request##id(void)
81
82
TRACE_REQUEST_FUNC(JVMInformation) {
83
ResourceMark rm;
84
EventJVMInformation event;
85
event.set_jvmName(VM_Version::vm_name());
86
event.set_jvmVersion(VM_Version::internal_vm_info_string());
87
event.set_javaArguments(Arguments::java_command());
88
event.set_jvmArguments(Arguments::jvm_args());
89
event.set_jvmFlags(Arguments::jvm_flags());
90
event.set_jvmStartTime(Management::vm_init_done_time());
91
event.set_pid(os::current_process_id());
92
event.commit();
93
}
94
95
TRACE_REQUEST_FUNC(OSInformation) {
96
ResourceMark rm;
97
char* os_name = NEW_RESOURCE_ARRAY(char, 2048);
98
JfrOSInterface::os_version(&os_name);
99
EventOSInformation event;
100
event.set_osVersion(os_name);
101
event.commit();
102
}
103
104
TRACE_REQUEST_FUNC(VirtualizationInformation) {
105
EventVirtualizationInformation event;
106
event.set_name(JfrOSInterface::virtualization_name());
107
event.commit();
108
}
109
110
TRACE_REQUEST_FUNC(ModuleRequire) {
111
JfrModuleEvent::generate_module_dependency_events();
112
}
113
114
TRACE_REQUEST_FUNC(ModuleExport) {
115
JfrModuleEvent::generate_module_export_events();
116
}
117
118
/*
119
* This is left empty on purpose, having ExecutionSample as a requestable
120
* is a way of getting the period. The period is passed to ThreadSampling::update_period.
121
* Implementation in jfrSamples.cpp
122
*/
123
TRACE_REQUEST_FUNC(ExecutionSample) {
124
}
125
TRACE_REQUEST_FUNC(NativeMethodSample) {
126
}
127
128
TRACE_REQUEST_FUNC(ThreadDump) {
129
ResourceMark rm;
130
EventThreadDump event;
131
event.set_result(JfrDcmdEvent::thread_dump());
132
event.commit();
133
}
134
135
static int _native_library_callback(const char* name, address base, address top, void *param) {
136
EventNativeLibrary event(UNTIMED);
137
event.set_name(name);
138
event.set_baseAddress((u8)base);
139
event.set_topAddress((u8)top);
140
event.set_endtime(*(JfrTicks*) param);
141
event.commit();
142
return 0;
143
}
144
145
TRACE_REQUEST_FUNC(NativeLibrary) {
146
JfrTicks ts= JfrTicks::now();
147
os::get_loaded_modules_info(&_native_library_callback, (void *)&ts);
148
}
149
150
TRACE_REQUEST_FUNC(InitialEnvironmentVariable) {
151
JfrOSInterface::generate_initial_environment_variable_events();
152
}
153
154
TRACE_REQUEST_FUNC(CPUInformation) {
155
CPUInformation cpu_info;
156
int ret_val = JfrOSInterface::cpu_information(cpu_info);
157
if (ret_val == OS_ERR) {
158
log_debug(jfr, system)( "Unable to generate requestable event CPUInformation");
159
return;
160
}
161
if (ret_val == FUNCTIONALITY_NOT_IMPLEMENTED) {
162
return;
163
}
164
if (ret_val == OS_OK) {
165
EventCPUInformation event;
166
event.set_cpu(cpu_info.cpu_name());
167
event.set_description(cpu_info.cpu_description());
168
event.set_sockets(cpu_info.number_of_sockets());
169
event.set_cores(cpu_info.number_of_cores());
170
event.set_hwThreads(cpu_info.number_of_hardware_threads());
171
event.commit();
172
}
173
}
174
175
TRACE_REQUEST_FUNC(CPULoad) {
176
double u = 0; // user time
177
double s = 0; // kernel time
178
double t = 0; // total time
179
int ret_val = OS_ERR;
180
{
181
// Can take some time on certain platforms, especially under heavy load.
182
// Transition to native to avoid unnecessary stalls for pending safepoint synchronizations.
183
ThreadToNativeFromVM transition(JavaThread::current());
184
ret_val = JfrOSInterface::cpu_loads_process(&u, &s, &t);
185
}
186
if (ret_val == OS_ERR) {
187
log_debug(jfr, system)( "Unable to generate requestable event CPULoad");
188
return;
189
}
190
if (ret_val == OS_OK) {
191
EventCPULoad event;
192
event.set_jvmUser((float)u);
193
event.set_jvmSystem((float)s);
194
event.set_machineTotal((float)t);
195
event.commit();
196
}
197
}
198
199
TRACE_REQUEST_FUNC(ThreadCPULoad) {
200
JfrThreadCPULoadEvent::send_events();
201
}
202
203
TRACE_REQUEST_FUNC(NetworkUtilization) {
204
JfrNetworkUtilization::send_events();
205
}
206
207
TRACE_REQUEST_FUNC(CPUTimeStampCounter) {
208
EventCPUTimeStampCounter event;
209
event.set_fastTimeEnabled(JfrTime::is_ft_enabled());
210
event.set_fastTimeAutoEnabled(JfrTime::is_ft_supported());
211
event.set_osFrequency(os::elapsed_frequency());
212
event.set_fastTimeFrequency(JfrTime::frequency());
213
event.commit();
214
}
215
216
TRACE_REQUEST_FUNC(SystemProcess) {
217
char pid_buf[16];
218
SystemProcess* processes = NULL;
219
int num_of_processes = 0;
220
JfrTicks start_time = JfrTicks::now();
221
int ret_val = JfrOSInterface::system_processes(&processes, &num_of_processes);
222
if (ret_val == OS_ERR) {
223
log_debug(jfr, system)( "Unable to generate requestable event SystemProcesses");
224
return;
225
}
226
JfrTicks end_time = JfrTicks::now();
227
if (ret_val == FUNCTIONALITY_NOT_IMPLEMENTED) {
228
return;
229
}
230
if (ret_val == OS_OK) {
231
// feature is implemented, write real event
232
while (processes != NULL) {
233
SystemProcess* tmp = processes;
234
const char* info = processes->command_line();
235
if (info == NULL) {
236
info = processes->path();
237
}
238
if (info == NULL) {
239
info = processes->name();
240
}
241
if (info == NULL) {
242
info = "?";
243
}
244
jio_snprintf(pid_buf, sizeof(pid_buf), "%d", processes->pid());
245
EventSystemProcess event(UNTIMED);
246
event.set_pid(pid_buf);
247
event.set_commandLine(info);
248
event.set_starttime(start_time);
249
event.set_endtime(end_time);
250
event.commit();
251
processes = processes->next();
252
delete tmp;
253
}
254
}
255
}
256
257
TRACE_REQUEST_FUNC(ThreadContextSwitchRate) {
258
double rate = 0.0;
259
int ret_val = OS_ERR;
260
{
261
// Can take some time on certain platforms, especially under heavy load.
262
// Transition to native to avoid unnecessary stalls for pending safepoint synchronizations.
263
ThreadToNativeFromVM transition(JavaThread::current());
264
ret_val = JfrOSInterface::context_switch_rate(&rate);
265
}
266
if (ret_val == OS_ERR) {
267
log_debug(jfr, system)( "Unable to generate requestable event ThreadContextSwitchRate");
268
return;
269
}
270
if (ret_val == FUNCTIONALITY_NOT_IMPLEMENTED) {
271
return;
272
}
273
if (ret_val == OS_OK) {
274
EventThreadContextSwitchRate event;
275
event.set_switchRate((float)rate + 0.0f);
276
event.commit();
277
}
278
}
279
280
#define SEND_FLAGS_OF_TYPE(eventType, flagType) \
281
do { \
282
JVMFlag *flag = JVMFlag::flags; \
283
while (flag->name() != NULL) { \
284
if (flag->is_ ## flagType()) { \
285
if (flag->is_unlocked()) { \
286
Event ## eventType event; \
287
event.set_name(flag->name()); \
288
event.set_value(flag->get_ ## flagType()); \
289
event.set_origin(static_cast<u8>(flag->get_origin())); \
290
event.commit(); \
291
} \
292
} \
293
++flag; \
294
} \
295
} while (0)
296
297
TRACE_REQUEST_FUNC(IntFlag) {
298
SEND_FLAGS_OF_TYPE(IntFlag, int);
299
}
300
301
TRACE_REQUEST_FUNC(UnsignedIntFlag) {
302
SEND_FLAGS_OF_TYPE(UnsignedIntFlag, uint);
303
}
304
305
TRACE_REQUEST_FUNC(LongFlag) {
306
SEND_FLAGS_OF_TYPE(LongFlag, intx);
307
}
308
309
TRACE_REQUEST_FUNC(UnsignedLongFlag) {
310
SEND_FLAGS_OF_TYPE(UnsignedLongFlag, uintx);
311
SEND_FLAGS_OF_TYPE(UnsignedLongFlag, uint64_t);
312
SEND_FLAGS_OF_TYPE(UnsignedLongFlag, size_t);
313
}
314
315
TRACE_REQUEST_FUNC(DoubleFlag) {
316
SEND_FLAGS_OF_TYPE(DoubleFlag, double);
317
}
318
319
TRACE_REQUEST_FUNC(BooleanFlag) {
320
SEND_FLAGS_OF_TYPE(BooleanFlag, bool);
321
}
322
323
TRACE_REQUEST_FUNC(StringFlag) {
324
SEND_FLAGS_OF_TYPE(StringFlag, ccstr);
325
}
326
327
class VM_GC_SendObjectCountEvent : public VM_GC_HeapInspection {
328
public:
329
VM_GC_SendObjectCountEvent() : VM_GC_HeapInspection(NULL, true) {}
330
virtual void doit() {
331
ObjectCountEventSender::enable_requestable_event();
332
collect();
333
ObjectCountEventSender::disable_requestable_event();
334
}
335
};
336
337
TRACE_REQUEST_FUNC(ObjectCount) {
338
VM_GC_SendObjectCountEvent op;
339
VMThread::execute(&op);
340
}
341
342
TRACE_REQUEST_FUNC(G1HeapRegionInformation) {
343
G1GC_ONLY(G1HeapRegionEventSender::send_events());
344
}
345
346
// Java Mission Control (JMC) uses (Java) Long.MIN_VALUE to describe that a
347
// long value is undefined.
348
static jlong jmc_undefined_long = min_jlong;
349
350
TRACE_REQUEST_FUNC(GCConfiguration) {
351
GCConfiguration conf;
352
jlong pause_target = conf.has_pause_target_default_value() ? jmc_undefined_long : conf.pause_target();
353
EventGCConfiguration event;
354
event.set_youngCollector(conf.young_collector());
355
event.set_oldCollector(conf.old_collector());
356
event.set_parallelGCThreads(conf.num_parallel_gc_threads());
357
event.set_concurrentGCThreads(conf.num_concurrent_gc_threads());
358
event.set_usesDynamicGCThreads(conf.uses_dynamic_gc_threads());
359
event.set_isExplicitGCConcurrent(conf.is_explicit_gc_concurrent());
360
event.set_isExplicitGCDisabled(conf.is_explicit_gc_disabled());
361
event.set_gcTimeRatio(conf.gc_time_ratio());
362
event.set_pauseTarget((s8)pause_target);
363
event.commit();
364
}
365
366
TRACE_REQUEST_FUNC(GCTLABConfiguration) {
367
GCTLABConfiguration conf;
368
EventGCTLABConfiguration event;
369
event.set_usesTLABs(conf.uses_tlabs());
370
event.set_minTLABSize(conf.min_tlab_size());
371
event.set_tlabRefillWasteLimit(conf.tlab_refill_waste_limit());
372
event.commit();
373
}
374
375
TRACE_REQUEST_FUNC(GCSurvivorConfiguration) {
376
GCSurvivorConfiguration conf;
377
EventGCSurvivorConfiguration event;
378
event.set_maxTenuringThreshold(conf.max_tenuring_threshold());
379
event.set_initialTenuringThreshold(conf.initial_tenuring_threshold());
380
event.commit();
381
}
382
383
TRACE_REQUEST_FUNC(GCHeapConfiguration) {
384
GCHeapConfiguration conf;
385
EventGCHeapConfiguration event;
386
event.set_minSize(conf.min_size());
387
event.set_maxSize(conf.max_size());
388
event.set_initialSize(conf.initial_size());
389
event.set_usesCompressedOops(conf.uses_compressed_oops());
390
event.set_compressedOopsMode(conf.narrow_oop_mode());
391
event.set_objectAlignment(conf.object_alignment_in_bytes());
392
event.set_heapAddressBits(conf.heap_address_size_in_bits());
393
event.commit();
394
}
395
396
TRACE_REQUEST_FUNC(YoungGenerationConfiguration) {
397
GCYoungGenerationConfiguration conf;
398
jlong max_size = conf.has_max_size_default_value() ? jmc_undefined_long : conf.max_size();
399
EventYoungGenerationConfiguration event;
400
event.set_maxSize((u8)max_size);
401
event.set_minSize(conf.min_size());
402
event.set_newRatio(conf.new_ratio());
403
event.commit();
404
}
405
406
TRACE_REQUEST_FUNC(InitialSystemProperty) {
407
SystemProperty* p = Arguments::system_properties();
408
JfrTicks time_stamp = JfrTicks::now();
409
while (p != NULL) {
410
if (!p->internal()) {
411
EventInitialSystemProperty event(UNTIMED);
412
event.set_key(p->key());
413
event.set_value(p->value());
414
event.set_endtime(time_stamp);
415
event.commit();
416
}
417
p = p->next();
418
}
419
}
420
421
TRACE_REQUEST_FUNC(ThreadAllocationStatistics) {
422
ResourceMark rm;
423
int initial_size = Threads::number_of_threads();
424
GrowableArray<jlong> allocated(initial_size);
425
GrowableArray<traceid> thread_ids(initial_size);
426
JfrTicks time_stamp = JfrTicks::now();
427
JfrJavaThreadIterator iter;
428
while (iter.has_next()) {
429
JavaThread* const jt = iter.next();
430
assert(jt != NULL, "invariant");
431
allocated.append(jt->cooked_allocated_bytes());
432
thread_ids.append(JFR_THREAD_ID(jt));
433
}
434
435
// Write allocation statistics to buffer.
436
for(int i = 0; i < thread_ids.length(); i++) {
437
EventThreadAllocationStatistics event(UNTIMED);
438
event.set_allocated(allocated.at(i));
439
event.set_thread(thread_ids.at(i));
440
event.set_endtime(time_stamp);
441
event.commit();
442
}
443
}
444
445
/**
446
* PhysicalMemory event represents:
447
*
448
* @totalSize == The amount of physical memory (hw) installed and reported by the OS, in bytes.
449
* @usedSize == The amount of physical memory currently in use in the system (reserved/committed), in bytes.
450
*
451
* Both fields are systemwide, i.e. represents the entire OS/HW environment.
452
* These fields do not include virtual memory.
453
*
454
* If running inside a guest OS on top of a hypervisor in a virtualized environment,
455
* the total memory reported is the amount of memory configured for the guest OS by the hypervisor.
456
*/
457
TRACE_REQUEST_FUNC(PhysicalMemory) {
458
u8 totalPhysicalMemory = os::physical_memory();
459
EventPhysicalMemory event;
460
event.set_totalSize(totalPhysicalMemory);
461
event.set_usedSize(totalPhysicalMemory - os::available_memory());
462
event.commit();
463
}
464
465
TRACE_REQUEST_FUNC(JavaThreadStatistics) {
466
EventJavaThreadStatistics event;
467
event.set_activeCount(ThreadService::get_live_thread_count());
468
event.set_daemonCount(ThreadService::get_daemon_thread_count());
469
event.set_accumulatedCount(ThreadService::get_total_thread_count());
470
event.set_peakCount(ThreadService::get_peak_thread_count());
471
event.commit();
472
}
473
474
TRACE_REQUEST_FUNC(ClassLoadingStatistics) {
475
EventClassLoadingStatistics event;
476
event.set_loadedClassCount(ClassLoadingService::loaded_class_count());
477
event.set_unloadedClassCount(ClassLoadingService::unloaded_class_count());
478
event.commit();
479
}
480
481
class JfrClassLoaderStatsClosure : public ClassLoaderStatsClosure {
482
public:
483
JfrClassLoaderStatsClosure() : ClassLoaderStatsClosure(NULL) {}
484
485
bool do_entry(oop const& key, ClassLoaderStats const& cls) {
486
const ClassLoaderData* this_cld = cls._class_loader != NULL ?
487
java_lang_ClassLoader::loader_data_acquire(cls._class_loader) : NULL;
488
const ClassLoaderData* parent_cld = cls._parent != NULL ?
489
java_lang_ClassLoader::loader_data_acquire(cls._parent) : NULL;
490
EventClassLoaderStatistics event;
491
event.set_classLoader(this_cld);
492
event.set_parentClassLoader(parent_cld);
493
event.set_classLoaderData((intptr_t)cls._cld);
494
event.set_classCount(cls._classes_count);
495
event.set_chunkSize(cls._chunk_sz);
496
event.set_blockSize(cls._block_sz);
497
event.set_hiddenClassCount(cls._hidden_classes_count);
498
event.set_hiddenChunkSize(cls._hidden_chunk_sz);
499
event.set_hiddenBlockSize(cls._hidden_block_sz);
500
event.commit();
501
return true;
502
}
503
504
void createEvents(void) {
505
_stats->iterate(this);
506
}
507
};
508
509
class JfrClassLoaderStatsVMOperation : public ClassLoaderStatsVMOperation {
510
public:
511
JfrClassLoaderStatsVMOperation() : ClassLoaderStatsVMOperation(NULL) { }
512
513
void doit() {
514
JfrClassLoaderStatsClosure clsc;
515
ClassLoaderDataGraph::loaded_cld_do(&clsc);
516
clsc.createEvents();
517
}
518
};
519
520
TRACE_REQUEST_FUNC(ClassLoaderStatistics) {
521
JfrClassLoaderStatsVMOperation op;
522
VMThread::execute(&op);
523
}
524
525
template<typename EVENT>
526
static void emit_table_statistics(TableStatistics statistics) {
527
EVENT event;
528
event.set_bucketCount(statistics._number_of_buckets);
529
event.set_entryCount(statistics._number_of_entries);
530
event.set_totalFootprint(statistics._total_footprint);
531
event.set_bucketCountMaximum(statistics._maximum_bucket_size);
532
event.set_bucketCountAverage(statistics._average_bucket_size);
533
event.set_bucketCountVariance(statistics._variance_of_bucket_size);
534
event.set_bucketCountStandardDeviation(statistics._stddev_of_bucket_size);
535
event.set_insertionRate(statistics._add_rate);
536
event.set_removalRate(statistics._remove_rate);
537
event.commit();
538
}
539
540
TRACE_REQUEST_FUNC(SymbolTableStatistics) {
541
TableStatistics statistics = SymbolTable::get_table_statistics();
542
emit_table_statistics<EventSymbolTableStatistics>(statistics);
543
}
544
545
TRACE_REQUEST_FUNC(StringTableStatistics) {
546
TableStatistics statistics = StringTable::get_table_statistics();
547
emit_table_statistics<EventStringTableStatistics>(statistics);
548
}
549
550
TRACE_REQUEST_FUNC(PlaceholderTableStatistics) {
551
TableStatistics statistics = SystemDictionary::placeholders_statistics();
552
emit_table_statistics<EventPlaceholderTableStatistics>(statistics);
553
}
554
555
TRACE_REQUEST_FUNC(LoaderConstraintsTableStatistics) {
556
TableStatistics statistics = SystemDictionary::loader_constraints_statistics();
557
emit_table_statistics<EventLoaderConstraintsTableStatistics>(statistics);
558
}
559
560
TRACE_REQUEST_FUNC(ProtectionDomainCacheTableStatistics) {
561
TableStatistics statistics = SystemDictionary::protection_domain_cache_statistics();
562
emit_table_statistics<EventProtectionDomainCacheTableStatistics>(statistics);
563
}
564
565
TRACE_REQUEST_FUNC(CompilerStatistics) {
566
EventCompilerStatistics event;
567
event.set_compileCount(CompileBroker::get_total_compile_count());
568
event.set_bailoutCount(CompileBroker::get_total_bailout_count());
569
event.set_invalidatedCount(CompileBroker::get_total_invalidated_count());
570
event.set_osrCompileCount(CompileBroker::get_total_osr_compile_count());
571
event.set_standardCompileCount(CompileBroker::get_total_standard_compile_count());
572
event.set_osrBytesCompiled(CompileBroker::get_sum_osr_bytes_compiled());
573
event.set_standardBytesCompiled(CompileBroker::get_sum_standard_bytes_compiled());
574
event.set_nmethodsSize(CompileBroker::get_sum_nmethod_size());
575
event.set_nmethodCodeSize(CompileBroker::get_sum_nmethod_code_size());
576
event.set_peakTimeSpent(CompileBroker::get_peak_compilation_time());
577
event.set_totalTimeSpent(CompileBroker::get_total_compilation_time());
578
event.commit();
579
}
580
581
TRACE_REQUEST_FUNC(CompilerConfiguration) {
582
EventCompilerConfiguration event;
583
event.set_threadCount(CICompilerCount);
584
event.set_tieredCompilation(TieredCompilation);
585
event.commit();
586
}
587
588
TRACE_REQUEST_FUNC(CodeCacheStatistics) {
589
// Emit stats for all available code heaps
590
for (int bt = 0; bt < CodeBlobType::NumTypes; ++bt) {
591
if (CodeCache::heap_available(bt)) {
592
EventCodeCacheStatistics event;
593
event.set_codeBlobType((u1)bt);
594
event.set_startAddress((u8)CodeCache::low_bound(bt));
595
event.set_reservedTopAddress((u8)CodeCache::high_bound(bt));
596
event.set_entryCount(CodeCache::blob_count(bt));
597
event.set_methodCount(CodeCache::nmethod_count(bt));
598
event.set_adaptorCount(CodeCache::adapter_count(bt));
599
event.set_unallocatedCapacity(CodeCache::unallocated_capacity(bt));
600
event.set_fullCount(CodeCache::get_codemem_full_count(bt));
601
event.commit();
602
}
603
}
604
}
605
606
TRACE_REQUEST_FUNC(CodeCacheConfiguration) {
607
EventCodeCacheConfiguration event;
608
event.set_initialSize(InitialCodeCacheSize);
609
event.set_reservedSize(ReservedCodeCacheSize);
610
event.set_nonNMethodSize(NonNMethodCodeHeapSize);
611
event.set_profiledSize(ProfiledCodeHeapSize);
612
event.set_nonProfiledSize(NonProfiledCodeHeapSize);
613
event.set_expansionSize(CodeCacheExpansionSize);
614
event.set_minBlockLength(CodeCacheMinBlockLength);
615
event.set_startAddress((u8)CodeCache::low_bound());
616
event.set_reservedTopAddress((u8)CodeCache::high_bound());
617
event.commit();
618
}
619
620
TRACE_REQUEST_FUNC(CodeSweeperStatistics) {
621
EventCodeSweeperStatistics event;
622
event.set_sweepCount(NMethodSweeper::traversal_count());
623
event.set_methodReclaimedCount(NMethodSweeper::total_nof_methods_reclaimed());
624
event.set_totalSweepTime(NMethodSweeper::total_time_sweeping());
625
event.set_peakFractionTime(NMethodSweeper::peak_sweep_fraction_time());
626
event.set_peakSweepTime(NMethodSweeper::peak_sweep_time());
627
event.commit();
628
}
629
630
TRACE_REQUEST_FUNC(CodeSweeperConfiguration) {
631
EventCodeSweeperConfiguration event;
632
event.set_sweeperEnabled(MethodFlushing);
633
event.set_flushingEnabled(UseCodeCacheFlushing);
634
event.set_sweepThreshold(NMethodSweeper::sweep_threshold_bytes());
635
event.commit();
636
}
637
638
639
TRACE_REQUEST_FUNC(ShenandoahHeapRegionInformation) {
640
#if INCLUDE_SHENANDOAHGC
641
if (UseShenandoahGC) {
642
VM_ShenandoahSendHeapRegionInfoEvents op;
643
VMThread::execute(&op);
644
}
645
#endif
646
}
647
648