diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 2f3eded54b0cc65a6d2ac59456a2acf2d7921059..05f5627609587cc7c24d13f20c878e8e00b2794d 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -2250,9 +2250,18 @@ int perf_header__fprintf_info(struct perf_session *session, FILE *fp, bool full) struct header_print_data hd; struct perf_header *header = &session->header; int fd = perf_data_file__fd(session->file); + struct stat st; + int ret; + hd.fp = fp; hd.full = full; + ret = fstat(fd, &st); + if (ret == -1) + return -1; + + fprintf(fp, "# captured on: %s", ctime(&st.st_ctime)); + perf_header__process_sections(header, fd, &hd, perf_file_section__fprintf_info); return 0; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 5d61242a6e648a1b65c8b9d16c93e02f8ed655cd..f268201048a0b69774cef2e6a8f4cb4a1634de01 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2025,20 +2025,10 @@ int perf_session__cpu_bitmap(struct perf_session *session, void perf_session__fprintf_info(struct perf_session *session, FILE *fp, bool full) { - struct stat st; - int fd, ret; - if (session == NULL || fp == NULL) return; - fd = perf_data_file__fd(session->file); - - ret = fstat(fd, &st); - if (ret == -1) - return; - fprintf(fp, "# ========\n"); - fprintf(fp, "# captured on: %s", ctime(&st.st_ctime)); perf_header__fprintf_info(session, fp, full); fprintf(fp, "# ========\n#\n"); }