Skip to content

Commit 0d73096

Browse files
committed
Add time stamp in DirStat.json file name
1 parent ef47176 commit 0d73096

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/XrdPfc/XrdPfcResourceMonitor.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,22 @@ void ResourceMonitor::heart_beat()
464464
// This should really be export to a file (preferably binary, but then bin->json command is needed, too).
465465
// ss.dump();
466466

467-
const char* dumpfile = "/pfc-stats/DirStat.json";
467+
std::string dumpfile = "/pfc-stats/DirStat.json-";
468+
time_t time;
469+
struct tm t;
470+
localtime_r(&time, &t);
471+
472+
char buf[256];
473+
snprintf(buf, sizeof(buf), "%d-%02d-%02d %02d:%02d:%02d",
474+
1900 + t.tm_year,
475+
1 + t.tm_mon,
476+
t.tm_mday,
477+
t.tm_hour,
478+
t.tm_min,
479+
t.tm_sec);
480+
481+
dumpfile += buf;
482+
468483
ss.write_json_file(dumpfile, m_oss, false);
469484
m_fs_state.reset_sshot_stats(queue_swap_time);
470485
}

0 commit comments

Comments
 (0)