< prev index next >

src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp

Print this page


   1 /*
   2  * Copyright (c) 2011, 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  *


 139   DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt));
 140   ResourceMark rm(jt);
 141   const char* const canonical_chunk_path = JfrJavaSupport::c_str(path, jt);
 142   if (NULL == canonical_chunk_path && !_chunkwriter->is_valid()) {
 143     // new output is NULL and current output is NULL
 144     return;
 145   }
 146   instance().set_chunk_path(canonical_chunk_path);
 147   notify_on_new_chunk_path();
 148 }
 149 
 150 void JfrRepository::set_path(jstring location, JavaThread* jt) {
 151   DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt));
 152   ResourceMark rm(jt);
 153   const char* const path = JfrJavaSupport::c_str(location, jt);
 154   if (path != NULL) {
 155     instance().set_path(path);
 156   }
 157 }
 158 




 159 bool JfrRepository::open_chunk(bool vm_error /* false */) {
 160   if (vm_error) {
 161     ResourceMark rm;
 162     _chunkwriter->set_path(JfrEmergencyDump::build_dump_path(_path));

 163   }
 164   return _chunkwriter->open();
 165 }
 166 
 167 size_t JfrRepository::close_chunk() {
 168   return _chunkwriter->close();
 169 }
 170 
 171 void JfrRepository::flush(JavaThread* jt) {
 172   DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt));
 173   if (!Jfr::is_recording()) {
 174     return;
 175   }
 176   if (!_chunkwriter->is_valid()) {
 177     return;
 178   }
 179   instance()._post_box.post(MSG_FLUSHPOINT);
 180 }
 181 
 182 size_t JfrRepository::flush_chunk() {
   1 /*
   2  * Copyright (c) 2011, 2020, 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  *


 139   DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt));
 140   ResourceMark rm(jt);
 141   const char* const canonical_chunk_path = JfrJavaSupport::c_str(path, jt);
 142   if (NULL == canonical_chunk_path && !_chunkwriter->is_valid()) {
 143     // new output is NULL and current output is NULL
 144     return;
 145   }
 146   instance().set_chunk_path(canonical_chunk_path);
 147   notify_on_new_chunk_path();
 148 }
 149 
 150 void JfrRepository::set_path(jstring location, JavaThread* jt) {
 151   DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt));
 152   ResourceMark rm(jt);
 153   const char* const path = JfrJavaSupport::c_str(location, jt);
 154   if (path != NULL) {
 155     instance().set_path(path);
 156   }
 157 }
 158 
 159 const char* JfrRepository::path() {
 160   return instance()._path;
 161 }
 162 
 163 bool JfrRepository::open_chunk(bool vm_error /* false */) {
 164   if (vm_error) {
 165     char chunk_path[JVM_MAXPATHLEN];
 166     JfrEmergencyDump::build_dump_path(_path, chunk_path, JVM_MAXPATHLEN);
 167     _chunkwriter->set_path(chunk_path);
 168   }
 169   return _chunkwriter->open();
 170 }
 171 
 172 size_t JfrRepository::close_chunk() {
 173   return _chunkwriter->close();
 174 }
 175 
 176 void JfrRepository::flush(JavaThread* jt) {
 177   DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt));
 178   if (!Jfr::is_recording()) {
 179     return;
 180   }
 181   if (!_chunkwriter->is_valid()) {
 182     return;
 183   }
 184   instance()._post_box.post(MSG_FLUSHPOINT);
 185 }
 186 
 187 size_t JfrRepository::flush_chunk() {
< prev index next >