1 /* 2 * Copyright (c) 2016, 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 #ifndef SHARE_VM_JFR_RECORDER_SERVICE_JFRRECORDERSERVICE_HPP 26 #define SHARE_VM_JFR_RECORDER_SERVICE_JFRRECORDERSERVICE_HPP 27 28 #include "jfr/utilities/jfrAllocation.hpp" 29 30 class JfrCheckpointManager; 31 class JfrChunkWriter; 32 class JfrRepository; 33 class JfrStackTraceRepository; 34 class JfrStorage; 35 class JfrStringPool; 36 37 class JfrRecorderService : public StackObj { 38 private: 39 JfrCheckpointManager& _checkpoint_manager; 40 JfrChunkWriter& _chunkwriter; 41 JfrRepository& _repository; 42 JfrStackTraceRepository& _stack_trace_repository; 43 JfrStorage& _storage; 44 JfrStringPool& _string_pool; 45 46 void open_new_chunk(bool vm_error = false); 47 void chunk_rotation(); 48 void in_memory_rotation(); 49 void serialize_storage_from_in_memory_recording(); 50 void finalize_current_chunk(); 51 void finalize_current_chunk_on_vm_error(); 52 void prepare_for_vm_error_rotation(); 53 void vm_error_rotation(); 54 55 void clear(); 56 void pre_safepoint_clear(); 57 void safepoint_clear(); 58 void invoke_safepoint_clear(); 59 void post_safepoint_clear(); 60 61 void write(); 62 void pre_safepoint_write(); 63 void safepoint_write(); 64 void invoke_safepoint_write(); 65 void post_safepoint_write(); 66 67 public: 68 JfrRecorderService(); 69 void start(); 70 void rotate(int msgs); 71 void process_full_buffers(); 72 void scavenge(); 73 void evaluate_chunk_size_for_rotation(); 74 static bool is_recording(); 75 }; 76 77 #endif // SHARE_VM_JFR_RECORDER_SERVICE_JFRRECORDERSERVICE_HPP