ren jfrChunkState jfrChunk JEP-349-branch
authormgronlun
Thu, 12 Sep 2019 11:35:02 +0200
branchJEP-349-branch
changeset 58101 84b0544833c4
parent 58100 0e549560be5e
child 58112 e7754025004b
child 58154 060d9d139109
ren jfrChunkState jfrChunk
src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp
src/hotspot/share/jfr/recorder/repository/jfrChunk.hpp
src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp
src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp	Thu Sep 12 10:49:15 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "jfr/dcmd/jfrDcmds.hpp"
-#include "jfr/recorder/jfrRecorder.hpp"
-#include "jfr/recorder/repository/jfrChunkState.hpp"
-#include "jfr/recorder/repository/jfrChunkWriter.hpp"
-#include "jfr/utilities/jfrTime.hpp"
-#include "jfr/utilities/jfrTimeConverter.hpp"
-#include "logging/log.hpp"
-#include "runtime/os.inline.hpp"
-#include "runtime/thread.inline.hpp"
-
-JfrChunkState::JfrChunkState() :
-  _path(NULL),
-  _start_ticks(0),
-  _start_nanos(0),
-  _previous_start_ticks(0),
-  _previous_start_nanos(0),
-  _last_checkpoint_offset(0) {}
-
-JfrChunkState::~JfrChunkState() {
-  reset();
-}
-
-void JfrChunkState::reset() {
-  if (_path != NULL) {
-    JfrCHeapObj::free(_path, strlen(_path) + 1);
-    _path = NULL;
-  }
-  set_last_checkpoint_offset(0);
-}
-
-void JfrChunkState::set_last_checkpoint_offset(int64_t offset) {
-  _last_checkpoint_offset = offset;
-}
-
-int64_t JfrChunkState::last_checkpoint_offset() const {
-  return _last_checkpoint_offset;
-}
-
-int64_t JfrChunkState::previous_start_ticks() const {
-  return _previous_start_ticks;
-}
-
-int64_t JfrChunkState::previous_start_nanos() const {
-  return _previous_start_nanos;
-}
-
-void JfrChunkState::update_start_ticks() {
-  _start_ticks = JfrTicks::now();
-}
-
-void JfrChunkState::update_start_nanos() {
-  _start_nanos = os::javaTimeMillis() * JfrTimeConverter::NANOS_PER_MILLISEC;
-}
-
-void JfrChunkState::save_current_and_update_start_ticks() {
-  _previous_start_ticks = _start_ticks;
-  update_start_ticks();
-}
-
-void JfrChunkState::save_current_and_update_start_nanos() {
-  _previous_start_nanos = _start_nanos;
-  update_start_nanos();
-}
-
-void JfrChunkState::update_time_to_now() {
-  save_current_and_update_start_nanos();
-  save_current_and_update_start_ticks();
-}
-
-int64_t JfrChunkState::last_chunk_duration() const {
-  return _start_nanos - _previous_start_nanos;
-}
-
-static char* copy_path(const char* path) {
-  assert(path != NULL, "invariant");
-  const size_t path_len = strlen(path);
-  char* new_path = JfrCHeapObj::new_array<char>(path_len + 1);
-  strncpy(new_path, path, path_len + 1);
-  return new_path;
-}
-
-void JfrChunkState::set_path(const char* path) {
-  assert(JfrStream_lock->owned_by_self(), "invariant");
-  if (_path != NULL) {
-    JfrCHeapObj::free(_path, strlen(_path) + 1);
-    _path = NULL;
-  }
-  if (path != NULL) {
-    _path = copy_path(path);
-  }
-}
-
-const char* JfrChunkState::path() const {
-  return _path;
-}
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp	Thu Sep 12 10:49:15 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_JFR_RECORDER_REPOSITORY_JFRCHUNKSTATE_HPP
-#define SHARE_JFR_RECORDER_REPOSITORY_JFRCHUNKSTATE_HPP
-
-#include "jfr/utilities/jfrAllocation.hpp"
-#include "jfr/utilities/jfrTypes.hpp"
-
-class JfrChunkState : public JfrCHeapObj {
-  friend class JfrChunkWriter;
- private:
-  char* _path;
-  int64_t _start_ticks;
-  int64_t _start_nanos;
-  int64_t _previous_start_ticks;
-  int64_t _previous_start_nanos;
-  int64_t _last_checkpoint_offset;
-
-  void update_start_ticks();
-  void update_start_nanos();
-  void save_current_and_update_start_ticks();
-  void save_current_and_update_start_nanos();
-
-  JfrChunkState();
-  ~JfrChunkState();
-  void reset();
-  int64_t last_checkpoint_offset() const;
-  void set_last_checkpoint_offset(int64_t offset);
-  int64_t previous_start_ticks() const;
-  int64_t previous_start_nanos() const;
-  int64_t last_chunk_duration() const;
-  void update_time_to_now();
-  void set_path(const char* path);
-  const char* path() const;
-};
-
-#endif // SHARE_JFR_RECORDER_REPOSITORY_JFRCHUNKSTATE_HPP