Skip to content

Commit 6a43570

Browse files
authored
[Fix] fix a typo in event_trace_recorder (mlc-ai#2253)
* Fix typo in event_tracer
1 parent afde65c commit 6a43570

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cpp/serve/event_trace_recorder.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class EventTraceRecorderImpl : public EventTraceRecorderObj {
5151
void AddEvent(const Array<String>& request_ids, const std::string& event) final {
5252
double event_time = std::chrono::duration_cast<std::chrono::duration<double>>(
5353
std::chrono::system_clock::now().time_since_epoch())
54-
.count();
54+
.count(); // in seconds
5555

5656
{
5757
std::lock_guard<std::mutex> lock(mutex_);
@@ -96,16 +96,16 @@ class EventTraceRecorderImpl : public EventTraceRecorderObj {
9696
name = event;
9797
phase = "i";
9898
}
99-
int64_t event_time_in_ms = static_cast<int64_t>(event_time * 1e6);
99+
int64_t event_time_in_us = static_cast<int64_t>(event_time * 1e6);
100100

101101
picojson::object event_json;
102102
event_json["name"] = picojson::value(name);
103103
event_json["ph"] = picojson::value(phase);
104-
event_json["ts"] = picojson::value(event_time_in_ms);
104+
event_json["ts"] = picojson::value(event_time_in_us);
105105
event_json["pid"] = picojson::value(static_cast<int64_t>(1));
106106
event_json["tid"] = picojson::value(request_id);
107107

108-
events_to_sort.push_back({event_time_in_ms, picojson::value(event_json)});
108+
events_to_sort.push_back({event_time_in_us, picojson::value(event_json)});
109109
}
110110
std::sort(events_to_sort.begin(), events_to_sort.end(), fcmp_events);
111111
for (auto [timestamp, event] : events_to_sort) {

0 commit comments

Comments
 (0)