Skip to content

Commit

Permalink
Adds support for real_time in clock_definition
Browse files Browse the repository at this point in the history
With this change and a decently new Vampir, you can now see date
strings as time instead of fractional seconds.

We may want to drop the old attribute in favor of only writing the
clock_definition accordingly.
  • Loading branch information
bmario committed Oct 26, 2023
1 parent 14506b3 commit 6b7e619
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/lo2s/trace/trace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* along with lo2s. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <chrono>
#include <lo2s/address.hpp>
#include <lo2s/bfd_resolve.hpp>
#include <lo2s/config.hpp>
Expand Down Expand Up @@ -322,6 +323,7 @@ class Trace
std::recursive_mutex mutex_;

otf2::chrono::time_point starting_time_;
std::chrono::system_clock::time_point starting_system_time_;
otf2::chrono::time_point stopping_time_;

otf2::definition::interrupt_generator& interrupt_generator_;
Expand Down
2 changes: 1 addition & 1 deletion lib/otf2xx
7 changes: 5 additions & 2 deletions src/trace/trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* along with lo2s. If not, see <http://www.gnu.org/licenses/>.
*/

#include "otf2xx/chrono/duration.hpp"
#include <lo2s/trace/trace.hpp>

#include <lo2s/address.hpp>
Expand Down Expand Up @@ -199,8 +200,9 @@ void Trace::begin_record()
{
Log::info() << "Initialization done. Start recording...";
starting_time_ = time::now();
starting_system_time_ = std::chrono::system_clock::now();

const std::time_t t_c = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
const std::time_t t_c = std::chrono::system_clock::to_time_t(starting_system_time_);
add_lo2s_property("STARTING_TIME", fmt::format("{:%c}", fmt::localtime(t_c)));
}

Expand Down Expand Up @@ -257,7 +259,8 @@ Trace::~Trace()
stopping_time_ = starting_time_;
}

archive_ << otf2::definition::clock_properties(starting_time_, stopping_time_);
archive_ << otf2::definition::clock_properties(starting_time_, stopping_time_,
starting_system_time_);

std::filesystem::path symlink_path = nitro::env::get("LO2S_OUTPUT_LINK");

Expand Down

0 comments on commit 6b7e619

Please sign in to comment.