1 /*
2 * Disktest
3 * Copyright (c) International Business Machines Corp., 2001
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 *  Please send e-mail to yardleyb@us.ibm.com if you have
21 *  questions or comments.
22 *
23 *  Project Website:  TBD
24 *
25 * $Id: stats.h,v 1.2 2008/02/14 08:22:24 subrata_modak Exp $
26 *
27 */
28 
29 #ifndef _STATS_H
30 #define _STATS_H
31 
32 #ifdef WINDOWS
33 #include <windows.h>
34 #include <winioctl.h>
35 #include <io.h>
36 #include <process.h>
37 #include <sys/stat.h>
38 #else
39 #include <sys/types.h>
40 #include <sys/ioctl.h>
41 #include <unistd.h>
42 #endif
43 
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <stdarg.h>
47 #include <signal.h>
48 #include <time.h>
49 #include <errno.h>
50 #include "defs.h"
51 
52 #ifdef WINDOWS
53 #define CTRSTR "%I64d;Rbytes;%I64d;Rxfers;"
54 #define CTWSTR "%I64d;Wbytes;%I64d;Wxfers;"
55 #define TCTRSTR "%I64d;TRbytes;%I64d;TRxfers;"
56 #define TCTWSTR "%I64d;TWbytes;%I64d;TWxfers;"
57 #define HRTSTR "%I64d bytes read in %I64d transfers during heartbeat.\n"
58 #define HWTSTR "%I64d bytes written in %I64d transfers during heartbeat.\n"
59 #define CRTSTR "%I64d bytes read in %I64d transfers during cycle.\n"
60 #define CWTSTR "%I64d bytes written in %I64d transfers during cycle.\n"
61 #define TRTSTR "Total bytes read in %I64d transfers: %I64d\n"
62 #define TWTSTR "Total bytes written in %I64d transfers: %I64d\n"
63 #else
64 #define CTRSTR "%lld;Rbytes;%lld;Rxfers;"
65 #define CTWSTR "%lld;Wbytes;%lld;Wxfers;"
66 #define TCTRSTR "%lld;TRbytes;%lld;TRxfers;"
67 #define TCTWSTR "%lld;TWbytes;%lld;TWxfers;"
68 #define HRTSTR "%lld bytes read in %lld transfers during heartbeat.\n"
69 #define HWTSTR "%lld bytes written in %lld transfers during heartbeat.\n"
70 #define CRTSTR "%lld bytes read in %lld transfers during cycle.\n"
71 #define CWTSTR "%lld bytes written in %lld transfers during cycle.\n"
72 #define TRTSTR "Total bytes read in %lld transfers: %lld\n"
73 #define TWTSTR "Total bytes written in %lld transfers: %lld\n"
74 #endif
75 #define HRTHSTR "Heartbeat read throughput: %.1fB/s (%.2fMB/s), IOPS %.1f/s.\n"
76 #define HWTHSTR "Heartbeat write throughput: %.1fB/s (%.2fMB/s), IOPS %.1f/s.\n"
77 #define CRTHSTR "Cycle read throughput: %.1fB/s (%.2fMB/s), IOPS %.1f/s.\n"
78 #define CWTHSTR "Cycle write throughput: %.1fB/s (%.2fMB/s), IOPS %.1f/s.\n"
79 #define TRTHSTR "Total read throughput: %.1fB/s (%.2fMB/s), IOPS %.1f/s.\n"
80 #define TWTHSTR "Total write throughput: %.1fB/s (%.2fMB/s), IOPS %.1f/s.\n"
81 #define CTRRSTR "%.1f;RB/s;%.1f;RIOPS;"
82 #define CTRWSTR "%.1f;WB/s;%.1f;WIOPS;"
83 #define TCTRRSTR "%.1f;TRB/s;%.1f;TRIOPS;"
84 #define TCTRWSTR "%.1f;TWB/s;%.1f;TWIOPS;"
85 
86 typedef enum statop {
87 	HBEAT,CYCLE,TOTAL
88 } statop_t;
89 
90 
91 void print_stats(child_args_t *, test_env_t *, statop_t);
92 void update_gbl_stats(test_env_t *);
93 void update_cyc_stats(test_env_t *);
94 
95 #endif /* _STATS_H */
96