Skip to content

Commit 4fa41c4

Browse files
committed
create-checkpoints should handle "latest-trace"
Create checkpoints command need the actual trace dir resolved, so we let `TraceReader` handle that for us.
1 parent a31230f commit 4fa41c4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/CreateCheckpointsCommand.cc

+9-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ int CreateCheckpointsCommand::run(std::vector<std::string>& args) {
9696
return 1;
9797
}
9898

99+
if (trace_dir.empty()) {
100+
trace_dir = real_path(resolve_trace_name(""));
101+
}
102+
99103
auto verified_frames_to_checkpoint_at =
100104
CreateCheckpointsCommand::find_events_to_checkpoint(trace_dir, flags);
101105
if (verified_frames_to_checkpoint_at.empty()) {
@@ -108,6 +112,7 @@ int CreateCheckpointsCommand::run(std::vector<std::string>& args) {
108112
static bool create_persistent_checkpoint_dir(const string& trace_dir,
109113
FrameTime time) {
110114
string checkpoint_dir = trace_dir + "/checkpoint-" + std::to_string(time);
115+
LOG(debug) << "create checkpoint dir " << checkpoint_dir;
111116
if (mkdir(checkpoint_dir.c_str(), 0755) == 0) {
112117
return true;
113118
}
@@ -119,6 +124,7 @@ int CreateCheckpointsCommand::run_main(
119124
const std::vector<FrameTime>& verified_events) {
120125
DEBUG_ASSERT(!verified_events.empty() &&
121126
"No events provided to checkpoint at.");
127+
LOG(debug) << "creating " << verified_events.size() << " persistent checkpoints";
122128
ReplaySession::Flags session_flags{};
123129
ReplayTimeline timeline{ ReplaySession::create(trace_dir, session_flags) };
124130
auto& reader = timeline.current_session().trace_reader();
@@ -141,7 +147,8 @@ int CreateCheckpointsCommand::run_main(
141147
timeline.remove_explicit_checkpoint(mark);
142148
LOG(debug) << "Serialized checkpoint at event " << evt;
143149
} else {
144-
FATAL() << "Stopped at wrong event";
150+
FATAL() << "Stopped at wrong event: expected=" << evt
151+
<< " stopped at=" << session.trace_reader().time();
145152
}
146153
}
147154

@@ -153,6 +160,7 @@ int CreateCheckpointsCommand::run_main(
153160
std::vector<FrameTime> CreateCheckpointsCommand::find_events_to_checkpoint(
154161
const std::string& trace_dir, const CreateCheckpointsFlags& flags) {
155162
TraceReader reader{ trace_dir };
163+
LOG(debug) << "find events to checkpoint in " << trace_dir;
156164
std::vector<FrameTime> events;
157165
auto total = 0ul;
158166

0 commit comments

Comments
 (0)