Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libkineto/include/ActivityType.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum class ActivityType {
CUDA_PROFILER_RANGE, // MUPTI Profiler range for performance metrics
HPU_OP, // HPU host side runtime event
XPU_RUNTIME, // host side xpu runtime events
XPU_DRIVER, // host side xpu driver events
COLLECTIVE_COMM, // collective communication
MTIA_WORKLOADD, // MTIA workloadd events

Expand Down
1 change: 1 addition & 0 deletions libkineto/src/ActivityType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static constexpr std::array<ActivityTypeName, activityTypeCount + 1> map{{
{"musa_profiler_range", ActivityType::CUDA_PROFILER_RANGE},
{"hpu_op", ActivityType::HPU_OP},
{"xpu_runtime", ActivityType::XPU_RUNTIME},
{"xpu_driver", ActivityType::XPU_DRIVER},
{"collective_comm", ActivityType::COLLECTIVE_COMM},
{"mtia_workloadd", ActivityType::MTIA_WORKLOADD},
{"privateuse1_runtime", ActivityType::PRIVATEUSE1_RUNTIME},
Expand Down
8 changes: 6 additions & 2 deletions libkineto/src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ const seconds Config::maxRequestAge() const {

static std::string getTimeStr(time_point<system_clock> t) {
std::time_t t_c = system_clock::to_time_t(t);
return fmt::format("{:%H:%M:%S}", fmt::localtime(t_c));
std::tm tm;
localtime_r(&t_c, &tm);
return fmt::format("{:%H:%M:%S}", tm);
}

static time_point<system_clock> handleRequestTimestamp(int64_t ms) {
Expand Down Expand Up @@ -554,8 +556,10 @@ void Config::printActivityProfilerConfig(std::ostream& s) const {
}
} else if (hasProfileStartTime()) {
std::time_t t_c = system_clock::to_time_t(requestTimestamp());
std::tm tm;
localtime_r(&t_c, &tm);
s << " Trace start time: "
<< fmt::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(t_c));
<< fmt::format("{:%Y-%m-%d %H:%M:%S}", tm);
s << " Trace duration: " << activitiesDuration().count() << "ms"
<< std::endl;
s << " Warmup duration: " << activitiesWarmupDuration().count() << "s"
Expand Down
4 changes: 3 additions & 1 deletion libkineto/src/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ Logger::Logger(int severity, int line, const char* filePath, int errnum)

const auto tt =
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::tm tm;
localtime_r(&tt, &tm);
const char* file = strrchr(filePath, '/');
buf_ << fmt::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(tt)) << " "
buf_ << fmt::format("{:%Y-%m-%d %H:%M:%S}", tm) << " "
<< processId(false) << ":" << systemThreadId(false) << " "
<< (file ? file + 1 : filePath) << ":" << line << "] ";
}
Expand Down
4 changes: 3 additions & 1 deletion libkineto/src/output_csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ void EventCSVLogger::handleSample(int device, const Sample& sample, bool from_ne
if (out_) {
auto now = system_clock::now();
auto time = system_clock::to_time_t(now);
std::tm tm;
localtime_r(&time, &tm);
for (const Stat& s : sample.stats) {
if (eventNames_.find(s.name) == eventNames_.end()) {
continue;
}
*out_ << fmt::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(time)) << ",";
*out_ << fmt::format("{:%Y-%m-%d %H:%M:%S}", tm) << ",";
*out_ << sample.deltaMsec << ",";
*out_ << device << ",";
*out_ << s.name;
Expand Down
Loading