SDDSlib
Loading...
Searching...
No Matches
report_stats.c
Go to the documentation of this file.
1/**
2 * @file report_stats.c
3 * @brief Reports elapsed time, CPU time, BIO/DIO counts, page faults, and memory usage to a file.
4 *
5 * @copyright
6 * - (c) 2002 The University of Chicago, as Operator of Argonne National Laboratory.
7 * - (c) 2002 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
8 *
9 * @license
10 * This file is distributed under the terms of the Software License Agreement
11 * found in the file LICENSE included with this distribution.
12 *
13 * @author M. Borland, C. Saunders, R. Soliday
14 */
15
16#include "mdb.h"
17
18/**
19 * @brief Reports statistics to a specified file.
20 *
21 * This function formats and writes various statistics such as elapsed time, CPU time,
22 * BIO/DIO counts, page faults, and memory usage to the specified file.
23 *
24 * @param fp Pointer to the file where the statistics will be written.
25 * @param label A label string to prepend to the statistics output.
26 */
27void report_stats(FILE *fp, char *label) {
28 char s[200];
29 extern char *elapsed_time();
30 long cpu_time(), bio_count(), dio_count(), page_faults(), memory_count();
31
32 sprintf(s, "ET:%13s CP:%8.2f BIO:%ld DIO:%ld PF:%ld MEM:%ld", elapsed_time(),
33 cpu_time() / 100.0, bio_count(), dio_count(), page_faults(), memory_count());
34
35 fprintf(fp, "%s %s\n", label, s);
36 fflush(fp);
37}
void report_stats(FILE *fp, char *label)
Reports statistics to a specified file.