SDDS ToolKit Programs and Libraries for C and Python
All Classes Files Functions Variables Macros Pages
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"
17long bio_count();
18long dio_count();
19/**
20 * @brief Reports statistics to a specified file.
21 *
22 * This function formats and writes various statistics such as elapsed time, CPU time,
23 * BIO/DIO counts, page faults, and memory usage to the specified file.
24 *
25 * @param fp Pointer to the file where the statistics will be written.
26 * @param label A label string to prepend to the statistics output.
27 */
28void report_stats(FILE *fp, char *label) {
29 char s[200];
30 extern char *elapsed_time();
31 //long cpu_time(), bio_count(), dio_count(), page_faults(), memory_count();
32
33 sprintf(s, "ET:%13s CP:%8.2f BIO:%ld DIO:%ld PF:%ld MEM:%ld", elapsed_time(),
34 cpu_time() / 100.0, bio_count(), dio_count(), page_faults(), memory_count());
35
36 fprintf(fp, "%s %s\n", label, s);
37 fflush(fp);
38}
void report_stats(FILE *fp, char *label)
Reports statistics to a specified file.
long page_faults()
Retrieves the number of page faults since the last initialization.
Definition timer.c:144
long cpu_time()
Retrieves the CPU time used since the last initialization.
Definition timer.c:117