1 /*
2 * Copyright (c) 1998, 2014, 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 *
361 void VMThread::evaluate_operation(VM_Operation* op) {
362 ResourceMark rm;
363
364 {
365 PerfTraceTime vm_op_timer(perf_accumulated_vm_operation_time());
366 #ifndef USDT2
367 HS_DTRACE_PROBE3(hotspot, vmops__begin, op->name(), strlen(op->name()),
368 op->evaluation_mode());
369 #else /* USDT2 */
370 HOTSPOT_VMOPS_BEGIN(
371 (char *) op->name(), strlen(op->name()),
372 op->evaluation_mode());
373 #endif /* USDT2 */
374
375 EventExecuteVMOperation event;
376
377 op->evaluate();
378
379 if (event.should_commit()) {
380 bool is_concurrent = op->evaluate_concurrently();
381 event.set_operation(op->type());
382 event.set_safepoint(op->evaluate_at_safepoint());
383 event.set_blocking(!is_concurrent);
384 // Only write caller thread information for non-concurrent vm operations.
385 // For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
386 // This is because the caller thread could have exited already.
387 event.set_caller(is_concurrent ? 0 : op->calling_thread()->osthread()->thread_id());
388 event.commit();
389 }
390
391 #ifndef USDT2
392 HS_DTRACE_PROBE3(hotspot, vmops__end, op->name(), strlen(op->name()),
393 op->evaluation_mode());
394 #else /* USDT2 */
395 HOTSPOT_VMOPS_END(
396 (char *) op->name(), strlen(op->name()),
397 op->evaluation_mode());
398 #endif /* USDT2 */
399 }
400
401 // Last access of info in _cur_vm_operation!
402 bool c_heap_allocated = op->is_cheap_allocated();
403
404 // Mark as completed
405 if (!op->evaluate_concurrently()) {
406 op->calling_thread()->increment_vm_operation_completed_count();
407 }
|
1 /*
2 * Copyright (c) 1998, 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 *
361 void VMThread::evaluate_operation(VM_Operation* op) {
362 ResourceMark rm;
363
364 {
365 PerfTraceTime vm_op_timer(perf_accumulated_vm_operation_time());
366 #ifndef USDT2
367 HS_DTRACE_PROBE3(hotspot, vmops__begin, op->name(), strlen(op->name()),
368 op->evaluation_mode());
369 #else /* USDT2 */
370 HOTSPOT_VMOPS_BEGIN(
371 (char *) op->name(), strlen(op->name()),
372 op->evaluation_mode());
373 #endif /* USDT2 */
374
375 EventExecuteVMOperation event;
376
377 op->evaluate();
378
379 if (event.should_commit()) {
380 bool is_concurrent = op->evaluate_concurrently();
381 bool evaluate_at_safepoint = op->evaluate_at_safepoint();
382 event.set_operation(op->type());
383 event.set_safepoint(evaluate_at_safepoint);
384 event.set_blocking(!is_concurrent);
385 // Only write caller thread information for non-concurrent vm operations.
386 // For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
387 // This is because the caller thread could have exited already.
388 event.set_caller(is_concurrent ? 0 : THREAD_TRACE_ID(op->calling_thread()));
389 event.set_safepointId(evaluate_at_safepoint ? SafepointSynchronize::safepoint_counter() : 0);
390 event.commit();
391 }
392
393 #ifndef USDT2
394 HS_DTRACE_PROBE3(hotspot, vmops__end, op->name(), strlen(op->name()),
395 op->evaluation_mode());
396 #else /* USDT2 */
397 HOTSPOT_VMOPS_END(
398 (char *) op->name(), strlen(op->name()),
399 op->evaluation_mode());
400 #endif /* USDT2 */
401 }
402
403 // Last access of info in _cur_vm_operation!
404 bool c_heap_allocated = op->is_cheap_allocated();
405
406 // Mark as completed
407 if (!op->evaluate_concurrently()) {
408 op->calling_thread()->increment_vm_operation_completed_count();
409 }
|