2 * sar/sadc: Report system activity
3 * (C) 1999-2021 by Sebastien Godard (sysstat <at> orange.fr)
14 #include "rd_sensors.h"
17 ***************************************************************************
18 * Activity identification values.
19 ***************************************************************************
22 /* Number of activities */
24 /* The value below is used for sanity check */
25 #define MAX_NR_ACT 256
27 /* Number of functions used to count items */
50 #define A_NET_EICMP 20
54 #define A_NET_SOCK6 24
57 #define A_NET_ICMP6 27
58 #define A_NET_EICMP6 28
75 /* Macro used to flag an activity that should be collected */
76 #define COLLECT_ACTIVITY(m) act[get_activity_position(act, m, EXIT_IF_NOT_FOUND)]->options |= AO_COLLECTED
78 /* Macro used to flag an activity that should be selected */
79 #define SELECT_ACTIVITY(m) act[get_activity_position(act, m, EXIT_IF_NOT_FOUND)]->options |= AO_SELECTED
83 ***************************************************************************
85 ***************************************************************************
88 #define S_F_SINCE_BOOT 0x00000001
89 #define S_F_SA_ROTAT 0x00000002 /* Only used by sadc */
90 #define S_F_DEV_SID 0x00000002 /* Only used by sar/sadf */
91 #define S_F_PRETTY 0x00000004
92 #define S_F_FORCE_FILE 0x00000008
93 #define S_F_INTERVAL_SET 0x00000010
94 #define S_F_TRUE_TIME 0x00000020
95 #define S_F_LOCK_FILE 0x00000040
96 #define S_F_SEC_EPOCH 0x00000080
97 #define S_F_HDR_ONLY 0x00000100
98 #define S_F_FILE_LOCKED 0x00000200
99 #define S_F_SA_YYYYMMDD 0x00000400
100 #define S_F_HORIZONTALLY 0x00000800
101 #define S_F_COMMENT 0x00001000
102 #define S_F_PERSIST_NAME 0x00002000
103 #define S_F_LOCAL_TIME 0x00004000
104 #define S_F_PREFD_TIME_OUTPUT 0x00008000
105 #define S_F_SVG_SKIP 0x00010000
106 #define S_F_SVG_AUTOSCALE 0x00020000
107 #define S_F_SVG_ONE_DAY 0x00040000
108 #define S_F_SVG_SHOW_IDLE 0x00080000
109 #define S_F_UNIT 0x00100000
110 #define S_F_SVG_HEIGHT 0x00200000
111 #define S_F_SVG_PACKED 0x00400000
112 #define S_F_SVG_SHOW_INFO 0x00800000
113 /* Unused 0x01000000 */
114 #define S_F_ZERO_OMIT 0x02000000
115 #define S_F_SVG_SHOW_TOC 0x04000000
116 #define S_F_FDATASYNC 0x08000000
117 #define S_F_OPTION_A 0x10000000
118 #define S_F_OPTION_P 0x20000000
119 #define S_F_OPTION_I 0x40000000
120 #define S_F_DEBUG_MODE 0x80000000
122 #define WANT_SINCE_BOOT(m) (((m) & S_F_SINCE_BOOT) == S_F_SINCE_BOOT)
123 #define WANT_SA_ROTAT(m) (((m) & S_F_SA_ROTAT) == S_F_SA_ROTAT)
124 #define USE_STABLE_ID(m) (((m) & S_F_DEV_SID) == S_F_DEV_SID)
125 #define DISPLAY_PRETTY(m) (((m) & S_F_PRETTY) == S_F_PRETTY)
126 #define FORCE_FILE(m) (((m) & S_F_FORCE_FILE) == S_F_FORCE_FILE)
127 #define INTERVAL_SET(m) (((m) & S_F_INTERVAL_SET) == S_F_INTERVAL_SET)
128 #define PRINT_TRUE_TIME(m) (((m) & S_F_TRUE_TIME) == S_F_TRUE_TIME)
129 #define LOCK_FILE(m) (((m) & S_F_LOCK_FILE) == S_F_LOCK_FILE)
130 #define PRINT_SEC_EPOCH(m) (((m) & S_F_SEC_EPOCH) == S_F_SEC_EPOCH)
131 #define DISPLAY_HDR_ONLY(m) (((m) & S_F_HDR_ONLY) == S_F_HDR_ONLY)
132 #define FILE_LOCKED(m) (((m) & S_F_FILE_LOCKED) == S_F_FILE_LOCKED)
133 #define USE_SA_YYYYMMDD(m) (((m) & S_F_SA_YYYYMMDD) == S_F_SA_YYYYMMDD)
134 #define DISPLAY_HORIZONTALLY(m) (((m) & S_F_HORIZONTALLY) == S_F_HORIZONTALLY)
135 #define DISPLAY_COMMENT(m) (((m) & S_F_COMMENT) == S_F_COMMENT)
136 #define DISPLAY_PERSIST_NAME_S(m) (((m) & S_F_PERSIST_NAME) == S_F_PERSIST_NAME)
137 #define PRINT_LOCAL_TIME(m) (((m) & S_F_LOCAL_TIME) == S_F_LOCAL_TIME)
138 #define USE_PREFD_TIME_OUTPUT(m) (((m) & S_F_PREFD_TIME_OUTPUT) == S_F_PREFD_TIME_OUTPUT)
139 #define SKIP_EMPTY_VIEWS(m) (((m) & S_F_SVG_SKIP) == S_F_SVG_SKIP)
140 #define DISPLAY_ZERO_OMIT(m) (((m) & S_F_ZERO_OMIT) == S_F_ZERO_OMIT)
141 #define DISPLAY_DEBUG_MODE(m) (((m) & S_F_DEBUG_MODE) == S_F_DEBUG_MODE)
142 #define AUTOSCALE_ON(m) (((m) & S_F_SVG_AUTOSCALE) == S_F_SVG_AUTOSCALE)
143 #define DISPLAY_ONE_DAY(m) (((m) & S_F_SVG_ONE_DAY) == S_F_SVG_ONE_DAY)
144 #define DISPLAY_IDLE(m) (((m) & S_F_SVG_SHOW_IDLE) == S_F_SVG_SHOW_IDLE)
145 #define DISPLAY_INFO(m) (((m) & S_F_SVG_SHOW_INFO) == S_F_SVG_SHOW_INFO)
146 #define DISPLAY_UNIT(m) (((m) & S_F_UNIT) == S_F_UNIT)
147 #define SET_CANVAS_HEIGHT(m) (((m) & S_F_SVG_HEIGHT) == S_F_SVG_HEIGHT)
148 #define PACK_VIEWS(m) (((m) & S_F_SVG_PACKED) == S_F_SVG_PACKED)
149 #define DISPLAY_TOC(m) (((m) & S_F_SVG_SHOW_TOC) == S_F_SVG_SHOW_TOC)
150 #define FDATASYNC(m) (((m) & S_F_FDATASYNC) == S_F_FDATASYNC)
151 #define USE_OPTION_A(m) (((m) & S_F_OPTION_A) == S_F_OPTION_A)
152 #define USE_OPTION_P(m) (((m) & S_F_OPTION_P) == S_F_OPTION_P)
153 #define USE_OPTION_I(m) (((m) & S_F_OPTION_I) == S_F_OPTION_I)
155 #define AO_F_NULL 0x00000000
157 /* Output flags for options -r / -S */
158 #define AO_F_MEMORY 0x00000001
159 #define AO_F_SWAP 0x00000002
160 /* AO_F_MEM_ALL: See opt_flags in struct activity below */
161 #define AO_F_MEM_ALL (AO_F_MEMORY << 8)
163 #define DISPLAY_MEMORY(m) (((m) & AO_F_MEMORY) == AO_F_MEMORY)
164 #define DISPLAY_SWAP(m) (((m) & AO_F_SWAP) == AO_F_SWAP)
165 #define DISPLAY_MEM_ALL(m) (((m) & AO_F_MEM_ALL) == AO_F_MEM_ALL)
167 /* Output flags for option -u [ ALL ] */
168 #define AO_F_CPU_DEF 0x00000001
169 #define AO_F_CPU_ALL 0x00000002
171 #define DISPLAY_CPU_DEF(m) (((m) & AO_F_CPU_DEF) == AO_F_CPU_DEF)
172 #define DISPLAY_CPU_ALL(m) (((m) & AO_F_CPU_ALL) == AO_F_CPU_ALL)
174 /* Output flags for option -d */
175 #define AO_F_DISK_PART 0x00000001
177 #define COLLECT_PARTITIONS(m) (((m) & AO_F_DISK_PART) == AO_F_DISK_PART)
179 /* Output flags for option -F */
180 #define AO_F_FILESYSTEM 0x00000001
181 #define AO_F_MOUNT 0x00000002
183 #define DISPLAY_MOUNT(m) (((m) & AO_F_MOUNT) == AO_F_MOUNT)
186 ***************************************************************************
187 * Various keywords and constants.
188 ***************************************************************************
192 #define K_A_NULL "A_NULL"
194 #define K_PSI_CPU "CPU"
196 #define K_EDEV "EDEV"
197 #define K_EICMP "EICMP"
198 #define K_EICMP6 "EICMP6"
200 #define K_EIP6 "EIP6"
201 #define K_ETCP "ETCP"
204 #define K_FREQ "FREQ"
205 #define K_ICMP "ICMP"
206 #define K_ICMP6 "ICMP6"
208 #define K_PSI_IO "IO"
211 #define K_LOAD "LOAD"
212 #define K_PSI_MEM "MEM"
213 #define K_MOUNT "MOUNT"
215 #define K_NFSD "NFSD"
218 #define K_SOCK "SOCK"
219 #define K_SOCK6 "SOCK6"
220 #define K_SOFT "SOFT"
223 #define K_TEMP "TEMP"
225 #define K_UDP6 "UDP6"
226 #define K_XALL "XALL"
229 #define K_DISK "DISK"
230 #define K_XDISK "XDISK"
231 #define K_SNMP "SNMP"
232 #define K_IPV6 "IPV6"
233 #define K_POWER "POWER"
236 #define K_SKIP_EMPTY "skipempty"
237 #define K_AUTOSCALE "autoscale"
238 #define K_ONEDAY "oneday"
239 #define K_SHOWIDLE "showidle"
240 #define K_SHOWINFO "showinfo"
241 #define K_DEBUG "debug"
242 #define K_HEIGHT "height="
243 #define K_PACKED "packed"
244 #define K_SHOWTOC "showtoc"
245 #define K_CUSTOMCOL "customcol"
246 #define K_BWCOL "bwcol"
247 #define K_PCPARCHIVE "pcparchive="
250 /* Environment variables */
251 #define ENV_COLORS_PALETTE "S_COLORS_PALETTE"
253 /* Groups of activities */
254 #define G_DEFAULT 0x00
265 /* Time must have the format HH:MM:SS with HH in 24-hour format */
266 #define DEF_TMSTART "08:00:00"
267 #define DEF_TMEND "18:00:00"
269 #define UTSNAME_LEN 65
271 #define HEADER_LINE_LEN 512
274 * Define upper limit for various items.
275 * Made necessary because we have to check the number of
276 * items for each activity when we read a (possibly tainted)
279 #define MAX_NR_SERIAL_LINES 65536
280 #define MAX_NR_DISKS (65536 * 4096)
281 #define MAX_NR_IFACES 65536
282 #define MAX_NR_FANS 4096
283 #define MAX_NR_TEMP_SENSORS 4096
284 #define MAX_NR_IN_SENSORS 4096
285 #define MAX_NR_USB 65536
286 #define MAX_NR_FS (65536 * 4096)
287 #define MAX_NR_FCHOSTS 65536
289 /* NR_MAX is the upper limit used for unknown activities */
290 #define NR_MAX (65536 * 4096)
293 /* Maximum number of args that can be passed to sadc */
294 #define MAX_ARGV_NR 32
296 /* Miscellaneous constants */
298 #define USE_SA_FILE 1
299 #define NO_TM_START 0
307 #define ALL_ACTIVITIES ~0U
308 #define EXIT_IF_NOT_FOUND 1
309 #define RESUME_IF_NOT_FOUND 0
317 #define END_OF_DATA_UNEXPECTED 1
318 #define INCONSISTENT_INPUT_DATA 2
323 #define CLOSE_XML_MARKUP 0
324 #define OPEN_XML_MARKUP 1
326 #define CLOSE_JSON_MARKUP 0
327 #define OPEN_JSON_MARKUP 1
329 #define COUNT_ACTIVITIES 0
330 #define COUNT_OUTPUTS 1
332 /* Type for all functions reading statistics */
333 #define __read_funct_t void
334 /* Type for all functions displaying statistics */
335 #define __print_funct_t void
338 ***************************************************************************
339 * Output formats for sadf
340 ***************************************************************************
343 /* Number of output formats */
347 #define F_SAR_OUTPUT 0
348 #define F_DB_OUTPUT 1
349 #define F_HEADER_OUTPUT 2
350 #define F_PPC_OUTPUT 3
351 #define F_XML_OUTPUT 4
352 #define F_JSON_OUTPUT 5
353 #define F_CONV_OUTPUT 6
354 #define F_SVG_OUTPUT 7
355 #define F_RAW_OUTPUT 8
356 #define F_PCP_OUTPUT 9
359 /* Structure for SVG specific parameters */
361 unsigned long long dt; /* Interval of time for current sample */
362 unsigned long long ust_time_ref; /* X axis start time in seconds since the epoch */
363 unsigned long long ust_time_end; /* X axis end time in seconds since the epoch */
364 unsigned long long ust_time_first; /* Time (in seconds since the epoch) for first sample */
365 int graph_no; /* Total number of views already displayed */
366 int restart; /* TRUE if we have just met a RESTART record */
367 int nr_act_dispd; /* Number of activities that will be displayed */
368 struct file_header *file_hdr; /* Pointer on file header structure */
371 /* Structure used when displaying SVG header */
372 struct svg_hdr_parm {
373 int graph_nr; /* Number of rows of views to display or canvas height entered on the command line */
374 int views_per_row; /* Maximum number of views on a single row */
375 int nr_act_dispd; /* Number of activities that will be displayed */
379 ***************************************************************************
380 * System activity data files
382 * The rule is: "strict writing, read any", meaning that sar/sadc can
383 * only append data to a datafile whose format is strictly the same as that
384 * of current version (checking FORMAT_MAGIC is not enough), but sar/sadf
385 * can read data from different versions, providing that FORMAT_MAGIC value
386 * has not changed (note that we are talking here of data read from a file,
387 * not data that sar reads from sadc, in which case the "strict" rule applies).
389 * Format of system activity data files:
392 * | file_magic structure
396 * | file_header structure
400 * | file_activity structure | x file_header:sa_act_nr
404 * | extra_desc structure (exists only if file_header:extra_next != 0)
408 * | unknown extra structure(s) | x extra_desc:extra_nr
412 * | (extra_desc structure (exists only if previous extra_desc:extra_next != 0))
420 * | record_header structure |
424 * | extra_desc structure (exists only if record_header:extra_next != 0)
428 * | unknown extra structure(s) | x extra_desc:extra_nr
432 * | (extra_desc structure (exists only if previous extra_desc:extra_next != 0))
442 * | Statistics structure(s) | x <count>
448 * | Statistics structure(s)... |
452 * Note: For activities with varying number of items, a __nr_t value, giving
453 * the number of items, arrives before the statistics structures so that
454 * we know how many of them have to be read.
455 * NB: This value exists for all the activities even if they share the same
456 * count function (e.g. A_NET_DEV and A_NET_EDEV). Indeed, statistics are not
457 * read atomically and the number of items (e.g. network interfaces) may have
460 * If the record header's type is R_COMMENT then we find only a comment
461 * following the record_header structure.
463 * If the record_header's type is R_RESTART then we find only the number of CPU
464 * (of type __nr_t) of the machine following the record_header structure.
465 * This number is 1 for 1 CPU and not an SMP kernel (CPU "all"),
466 * 2 for 1 CPU and SMP kernel (CPU "all" and CPU 0), etc.
467 * Of course we display the real number of CPU (e.g. "1" for 1 CPU and SMP
468 * kernel) with the LINUX RESTART message.
470 * If the record_header's type is R_EXTRA* then we find only a list of extra
471 * structures following the record_header structure but no statistics ones.
472 * Note that extra structures may exist for all record_header types
473 * (R_STATS, R_COMMENT, R_RESTART...). For R_COMMENT and R_RESTART records,
474 * the extra structures will be found after the comment or the number of CPU.
475 ***************************************************************************
479 * Sysstat magic number. Should never be modified.
480 * Indicate that the file was created by sysstat.
482 #define SYSSTAT_MAGIC 0xd596
483 #define SYSSTAT_MAGIC_SWAPPED (((SYSSTAT_MAGIC << 8) | (SYSSTAT_MAGIC >> 8)) & 0xffff)
486 * Datafile format magic number.
487 * Modified to indicate that the format of the file is
488 * no longer compatible with that of previous sysstat versions.
490 #define FORMAT_MAGIC 0x2175
491 #define FORMAT_MAGIC_SWAPPED (((FORMAT_MAGIC << 8) | (FORMAT_MAGIC >> 8)) & 0xffff)
493 /* Previous datafile format magic numbers used by older sysstat versions */
494 #define FORMAT_MAGIC_2171 0x2171
495 #define FORMAT_MAGIC_2171_SWAPPED (((FORMAT_MAGIC_2171 << 8) | (FORMAT_MAGIC_2171 >> 8)) & 0xffff)
496 #define FORMAT_MAGIC_2173 0x2173
497 #define FORMAT_MAGIC_2173_SWAPPED (((FORMAT_MAGIC_2173 << 8) | (FORMAT_MAGIC_2173 >> 8)) & 0xffff)
499 /* Padding in file_magic structure. See below. */
500 #define FILE_MAGIC_PADDING 48
502 /* Structure for file magic header data */
505 * This field identifies the file as a file created by sysstat.
507 unsigned short sysstat_magic;
509 * The value of this field varies whenever datafile format changes.
511 unsigned short format_magic;
513 * Sysstat version used to create the file.
515 unsigned char sysstat_version;
516 unsigned char sysstat_patchlevel;
517 unsigned char sysstat_sublevel;
518 unsigned char sysstat_extraversion;
519 #define FILE_MAGIC_ULL_NR 0 /* Nr of unsigned long long below */
520 #define FILE_MAGIC_UL_NR 0 /* Nr of unsigned long below */
521 #define FILE_MAGIC_U_NR 5 /* Nr of [unsigned] int below */
523 * Size of file's header (size of file_header structure used by file).
525 unsigned int header_size;
527 * Set to non zero if data file has been converted with "sadf -c" from
528 * an old format (version x.y.z) to a newest format (version X.Y.Z).
529 * In this case, the value is: Y*256 + Z + 1.
530 * The FORMAT_MAGIC value of the file can be used to determine X.
532 unsigned int upgraded;
534 * Description of the file_header structure
535 * (nr of "long long", nr of "long" and nr of "int").
537 unsigned int hdr_types_nr[3];
539 * Padding. Reserved for future use while avoiding a format change.
540 * sysstat always reads a number of bytes which is that expected for
541 * current sysstat version (FILE_MAGIC_SIZE). We cannot guess if we
542 * are going to read a file from current, an older or a newer version.
544 unsigned char pad[FILE_MAGIC_PADDING];
547 #define FILE_MAGIC_SIZE (sizeof(struct file_magic))
549 /* Header structure for system activity data file */
552 * Timestamp in seconds since the epoch.
554 unsigned long long sa_ust_time;
556 * Number of jiffies per second.
558 unsigned long sa_hz __attribute__ ((aligned (8)));
560 * Number of [online or offline] CPU (1 .. CPU_NR + 1)
561 * when the datafile has been created.
562 * When reading a datafile, this value is updated (in memory)
563 * whenever a RESTART record is found.
564 * When writing or appending data to a file, this field is updated
565 * neither in file nor in memory.
567 unsigned int sa_cpu_nr __attribute__ ((aligned (8)));
569 * Number of activities saved in file.
571 unsigned int sa_act_nr;
577 * Description of the file_activity and record_header structures
578 * (nr of "long long", nr of "long" and nr of "int").
580 unsigned int act_types_nr[3];
581 unsigned int rec_types_nr[3];
583 * Size of file_activity and record_header structures used by file.
585 unsigned int act_size;
586 unsigned int rec_size;
588 * TRUE if an extra_desc structure exists.
590 unsigned int extra_next;
592 * Current day and month.
593 * No need to save DST (Daylight Saving Time) flag, since it is not taken
594 * into account by the strftime() function used to print the timestamp.
596 unsigned char sa_day;
597 unsigned char sa_month;
599 * Size of a long integer. Useful to know the architecture on which
600 * the datafile was created.
604 * Operating system name.
606 char sa_sysname[UTSNAME_LEN];
610 char sa_nodename[UTSNAME_LEN];
612 * Operating system release number.
614 char sa_release[UTSNAME_LEN];
616 * Machine architecture.
618 char sa_machine[UTSNAME_LEN];
622 char sa_tzname[TZNAME_LEN];
625 #define FILE_HEADER_SIZE (sizeof(struct file_header))
626 #define FILE_HEADER_ULL_NR 1 /* Nr of unsigned long long in file_header structure */
627 #define FILE_HEADER_UL_NR 1 /* Nr of unsigned long in file_header structure */
628 #define FILE_HEADER_U_NR 12 /* Nr of [unsigned] int in file_header structure */
629 /* The values below are used for sanity check */
630 #define MIN_FILE_HEADER_SIZE 0
631 #define MAX_FILE_HEADER_SIZE 8192
635 * Base magical number for activities.
637 #define ACTIVITY_MAGIC_BASE 0x8a
639 /* List of activities saved in file */
640 struct file_activity {
642 * Identification value of activity.
646 * Activity magical number.
650 * Number of items for this activity
651 * when the data file has been created.
655 * Number of sub-items for this activity.
659 * Set to TRUE if statistics are preceded by
660 * a value giving the number of structures to read.
664 * Size of an item structure.
668 * Description of the structure containing statistics for the
669 * given activity (nr of "long long", nr of "long" and nr of "int").
671 unsigned int types_nr[3];
674 #define FILE_ACTIVITY_SIZE (sizeof(struct file_activity))
675 #define MAX_FILE_ACTIVITY_SIZE 1024 /* Used for sanity check */
676 #define FILE_ACTIVITY_ULL_NR 0 /* Nr of unsigned long long in file_activity structure */
677 #define FILE_ACTIVITY_UL_NR 0 /* Nr of unsigned long in file_activity structure */
678 #define FILE_ACTIVITY_U_NR 9 /* Nr of [unsigned] int in file_activity structure */
680 #define MAX_ITEM_STRUCT_SIZE 1024 /* Used for sanity check */
683 * Description of an extra structure.
684 * The composition of this structure should not change in time.
688 * Number of extra structures to read.
690 unsigned int extra_nr;
692 * Size of an extra structure.
694 unsigned int extra_size;
696 * TRUE if another extra_desc structure exists after
697 * all the extra structures.
699 unsigned int extra_next;
701 * Description of an extra structure
702 * (nr of "long long", nr of "long" and nr of "int").
704 unsigned int extra_types_nr[3];
707 #define EXTRA_DESC_SIZE (sizeof(struct extra_desc))
708 #define EXTRA_DESC_ULL_NR 0 /* Nr of unsigned long long in extra_desc structure */
709 #define EXTRA_DESC_UL_NR 0 /* Nr of unsigned long in extra_desc structure */
710 #define EXTRA_DESC_U_NR 6 /* Nr of [unsigned] int in extra_desc structure */
711 #define MAX_EXTRA_NR 8192
712 #define MAX_EXTRA_SIZE 1024
716 * R_STATS means that this is a record of statistics.
720 * R_RESTART means that this is a special record containing
721 * a LINUX RESTART message.
725 * R_LAST_STATS warns sar that this is the last record to be written
726 * to file before a file rotation, and that the next data to come will
728 * Such a record is tagged R_STATS anyway before being written to file.
730 #define R_LAST_STATS 3
732 * R_COMMENT means that this is a special record containing
737 * R_EXTRA* records means that extra structures are following current
738 * record_header structure, but no statistics structures.
740 #define R_EXTRA_MIN 5
741 #define R_EXTRA_MAX 15
743 /* Maximum length of a comment */
744 #define MAX_COMMENT_LEN 64
746 /* Header structure for every record */
747 struct record_header {
749 * Machine uptime in 1/100th of a second.
751 unsigned long long uptime_cs;
753 * Timestamp (number of seconds since the epoch).
755 unsigned long long ust_time;
757 * TRUE if an extra_desc structure exists.
759 unsigned int extra_next;
761 * Record type: R_STATS, R_RESTART,...
763 unsigned char record_type;
765 * Timestamp: Hour (0-23), minute (0-59) and second (0-60).
766 * Used to determine TRUE time.
767 * Hour value depends in fact on timezone (TZ variable) value.
770 unsigned char minute;
771 unsigned char second;
774 #define RECORD_HEADER_SIZE (sizeof(struct record_header))
775 #define MAX_RECORD_HEADER_SIZE 512 /* Used for sanity check */
776 #define RECORD_HEADER_ULL_NR 2 /* Nr of unsigned long long in record_header structure */
777 #define RECORD_HEADER_UL_NR 0 /* Nr of unsigned long in record_header structure */
778 #define RECORD_HEADER_U_NR 1 /* Nr of unsigned int in record_header structure */
782 ***************************************************************************
783 * Generic description of an activity.
784 ***************************************************************************
787 /* Activity options */
790 * Indicate that corresponding activity should be collected by sadc.
792 #define AO_COLLECTED 0x01
794 * Indicate that corresponding activity should be displayed by sar.
796 #define AO_SELECTED 0x02
798 * Indicate that corresponding activity has items that need to be counted.
799 * This means that its @f_count_index values is >= 0.
800 * (We use AO_COUNTED instead of @f_count_index because @f_count_index
801 * is available (initialized) only for sadc).
803 #define AO_COUNTED 0x04
805 * Indicate that activity's metrics have persistent values when devices
806 * are registered again (this means that when the device is registered again,
807 * the metrics pick the values they had when they had been unregistered).
808 * Exclusively used for CPU related statistics at the present time
809 * (e.g. A_CPU and A_NET_SOFT).
811 #define AO_PERSISTENT 0x08
813 * This flag should be set for every activity closing a markup used
814 * by several activities. Used by sadf f_xml_print() functions to
815 * display XML output, and also by f_json_print() functions to display JSON output.
817 #define AO_CLOSE_MARKUP 0x10
819 * Indicate that corresponding activity has multiple different
820 * output formats. This is the case for example for memory activity
821 * with options -r and -R.
822 * PS: Such an activity should appear in the list of activities that
823 * sar -A is supposed to display.
825 #define AO_MULTIPLE_OUTPUTS 0x20
827 * Indicate that one (SVG) graph will be displayed for each
828 * distinct item for this activity (sadf -g).
830 #define AO_GRAPH_PER_ITEM 0x40
832 * Indicate that this activity may have sub-items.
834 #define AO_MATRIX 0x80
836 * Indicate that a list of devices has been entered on the command
837 * line for this activity (see options --dev=, --iface=, ...)
839 #define AO_LIST_ON_CMDLINE 0x100
841 * Indicate that the number of items for this activity should always
842 * be counted, even if the activity is not collected.
844 #define AO_ALWAYS_COUNTED 0x200
846 * Indicate that corresponding activity should be collected only
847 * if a test has been successfully passed before.
848 * The test corresponds to the count() function (see @f_count_index).
849 * This is intended for activities with a fixed number of items but
850 * whose {/proc|/sys} files are not necessarily available, e.g. depending
851 * on the kernel version used. Unlike activities with AO_COUNTED flag,
852 * those having AO_DETECTED flag won't have a @has_nr number preceding
853 * their statistics structures in datafile.
855 #define AO_DETECTED 0x400
857 #define IS_COLLECTED(m) (((m) & AO_COLLECTED) == AO_COLLECTED)
858 #define IS_SELECTED(m) (((m) & AO_SELECTED) == AO_SELECTED)
859 #define HAS_COUNT_FUNCTION(m) (((m) & AO_COUNTED) == AO_COUNTED)
860 #define HAS_DETECT_FUNCTION(m) (((m) & AO_DETECTED) == AO_DETECTED)
861 #define HAS_PERSISTENT_VALUES(m) (((m) & AO_PERSISTENT) == AO_PERSISTENT)
862 #define CLOSE_MARKUP(m) (((m) & AO_CLOSE_MARKUP) == AO_CLOSE_MARKUP)
863 #define HAS_MULTIPLE_OUTPUTS(m) (((m) & AO_MULTIPLE_OUTPUTS) == AO_MULTIPLE_OUTPUTS)
864 #define ONE_GRAPH_PER_ITEM(m) (((m) & AO_GRAPH_PER_ITEM) == AO_GRAPH_PER_ITEM)
865 #define IS_MATRIX(m) (((m) & AO_MATRIX) == AO_MATRIX)
866 #define HAS_LIST_ON_CMDLINE(m) (((m) & AO_LIST_ON_CMDLINE) == AO_LIST_ON_CMDLINE)
867 #define ALWAYS_COUNT_ITEMS(m) (((m) & AO_ALWAYS_COUNTED) == AO_ALWAYS_COUNTED)
872 /* Structure used to define a bitmap needed by an activity */
875 * Bitmap for activities that need one. Remember to allocate it
878 unsigned char *b_array;
880 * Size of the bitmap in bits. In fact, bitmap is sized to b_size + 1
881 * to take into account CPU "all"
887 * Structure used to define an activity.
888 * Note: This structure can be modified without changing the format of data files.
892 * This variable contains the identification value (A_...) for this activity.
896 * Activity options (AO_...)
898 unsigned int options;
900 * Activity magical number. This number changes when activity format in file
901 * is no longer compatible with the format of that same activity from
906 * An activity belongs to a group (and only one).
907 * Groups are those selected with option -S of sadc.
911 * Index in f_count[] array to determine function used to count
912 * the number of items (serial lines, network interfaces, etc.) for
913 * activities with AO_COUNTED flag. Determine @nr value.
914 * Such a function should _always_ return a value greater than
917 * A value of -1 indicates that the number of items
918 * is a constant (and @nr_ini is set to this value).
920 * This function may be called even if corresponding activity has not
921 * been selected if flag AO_ALWAYS_COUNTED is set, to make sure that
922 * all items have been calculated (e.g. #CPU)
924 * The count() function may also be used to know if an activity (with
925 * AO_DETECTED flag) can actually be collected based on the presence of
926 * {/proc|/sys} files.
930 * Index in f_count[] array to determine function used to count the
931 * number of sub-items -> @nr2
932 * Such a function should _always_ return a value greater than
935 * A value of -1 indicates that the number of items is a constant
936 * (and @nr2 is set to this value).
940 * This function reads the relevant file and fill the buffer
941 * with statistics corresponding to given activity.
943 __read_funct_t (*f_read) (struct activity *);
945 * This function displays activity statistics onto the screen.
947 __print_funct_t (*f_print) (struct activity *, int, int, unsigned long long);
949 * This function displays average activity statistics onto the screen.
951 __print_funct_t (*f_print_avg) (struct activity *, int, int, unsigned long long);
953 * This function is used by sadf to display activity in a format that can
954 * easily be ingested by a relational database, or a format that can be
955 * handled by pattern processing commands like "awk".
957 __print_funct_t (*f_render) (struct activity *, int, char *, int, unsigned long long);
959 * This function is used by sadf to display activity statistics in XML.
961 __print_funct_t (*f_xml_print) (struct activity *, int, int, unsigned long long);
963 * This function is used by sadf to display activity statistics in JSON.
965 __print_funct_t (*f_json_print) (struct activity *, int, int, unsigned long long);
967 * This function is used by sadf to display activity statistics in SVG.
969 __print_funct_t (*f_svg_print) (struct activity *, int, int, struct svg_parm *,
970 unsigned long long, struct record_header *);
972 * This function is used by sadf to display activity statistics in raw format.
974 __print_funct_t (*f_raw_print) (struct activity *, char *, int);
976 * This function is used by sadf to display activity statistics in PCP format.
978 __print_funct_t (*f_pcp_print) (struct activity *, int);
980 * This function is used by sadf to count the number of new items in current
981 * sample and add them to the linked list @item_list.
983 __nr_t (*f_count_new) (struct activity *, int);
985 * Linked list containing item names. This is either all the different items
986 * found in a file for activities that have a @f_count_new() function (used by sadf),
987 * or a list entered on the command line (used by sadf and sar).
989 struct sa_item *item_list;
991 * Number of different items found in file (calculated by sadf).
992 * This is also the number of items in @item_list if this list exists.
996 * Header string displayed by sadf -d.
997 * Header lines for each output (for activities with multiple outputs) are
998 * separated with a '|' character.
999 * For a given output, the first field corresponding to extended statistics
1000 * (eg. -r ALL) begins with a '&' character.
1001 * A field having '*' in its name means that all items will have its own column
1002 * (the first one will be displayed as "all", the following ones will get the '*'
1003 * character replaced with their item number (0, 1, etc.)
1007 * Description of activity.
1015 * Description of the corresponding structure containing statistics (as defined
1016 * in rd_stats.h or rd_sensors.h). Such a structure has 0+ fields of type
1017 * "long long", followed by 0+ fields of type "long", followed by 0+ fields of
1018 * type "int", followed by 0+ other fields (e.g. of type char). The array below
1019 * gives the number of "long long" fields composing the structure, then the number
1020 * of "long" fields, then the number of "int" fields.
1022 unsigned int gtypes_nr[3];
1024 * This array has the same meaning as @gtypes_nr[] above, but the values are those
1025 * read from current data file. They may be different from those of @gtypes_nr[]
1026 * because we can read data from a different sysstat version (older or newer).
1028 unsigned int ftypes_nr[3];
1030 * Number of SVG graphs for this activity. The total number of graphs for
1031 * the activity can be greater though if flag AO_GRAPH_PER_ITEM is set, in
1032 * which case the total number will be @g_nr * @nr.
1036 * Number of items on the system, as counted when the system is initialized.
1037 * A negative value (-1) is the default value and indicates that this number
1038 * has still not been calculated by the function whose index is in @f_count_index.
1039 * A value of 0 means that this number has been calculated, but no items have
1041 * A positive value (>0) has either been calculated or is a constant.
1045 * Number of sub-items on the system.
1046 * @nr2 is in fact the second dimension of a matrix of items, the first
1047 * one being @nr. @nr is the number of lines, and @nr2 the number of columns.
1048 * A negative value (-1) is the default value and indicates that this number
1049 * has still not been calculated by the f_count2() function.
1050 * A value of 0 means that this number has been calculated, but no sub-items have
1052 * A positive value (>0) has either been calculated or is a constant.
1054 * 1) IF @nr2 = 0 THEN @nr_ini = 0
1055 * Note: If @nr_ini = 0, then @nr2 is undetermined (may be -1, 0 or >0).
1056 * 2) IF @nr_ini > 0 THEN @nr2 > 0.
1057 * Note: If @nr2 > 0 then @nr_ini is undetermined (may be -1, 0 or >0).
1058 * 3) IF @nr_ini <= 0 THEN @nr2 = -1 (this is the default value for @nr2,
1059 * meaning that it has not been calculated).
1063 * Maximum number of elements that sar can handle for this item.
1064 * NB: The maximum number of elements that sar can handle for sub-items
1069 * Number of items, as read and saved in corresponding buffer (@buf: See below).
1070 * The value may be zero for a particular sample if no items have been found.
1074 * Number of structures allocated in @buf[*]. This number should be greater
1075 * than or equal to @nr[*].
1077 __nr_t nr_allocated;
1080 * This is the size of the corresponding structure, as read from or written
1081 * to a file, or read from or written by the data collector.
1086 * This is the size of the corresponding structure as mapped into memory.
1087 * @msize can be different from @fsize when data are read from or written to
1088 * a data file from a different sysstat version.
1092 * Optional flags for activity. This is eg. used when AO_MULTIPLE_OUTPUTS
1094 * 0x0001 - 0x0080 : Multiple outputs (eg. AO_F_MEMORY, AO_F_SWAP...)
1095 * 0x0100 - 0x8000 : If bit set then display complete header (@hdr_line) for
1096 * corresponding output
1097 * 0x010000+ : Optional flags
1099 unsigned int opt_flags;
1101 * Buffers that will contain the statistics read. Its size is @nr * @nr2 * @size each.
1102 * [0]: used by sadc.
1103 * [0] and [1]: current/previous statistics values (used by sar).
1104 * [2]: Used by sar to save first collected stats (used later to
1109 * Bitmap for activities that need one. Such a bitmap is needed by activity
1110 * if @bitmap is not NULL.
1112 struct act_bitmap *bitmap;
1117 ***************************************************************************
1118 * Generic description of an output format for sadf (and sar).
1119 ***************************************************************************
1122 /* Type for all functions used by sadf to display stats in various formats */
1123 #define __printf_funct_t void
1124 #define __tm_funct_t char *
1127 * Structure used to define a report.
1128 * A XML-like report has the following format:
1134 * | | Statistics block
1137 * | | | Timestamp block
1140 * | | | | Activity #1
1146 * | | | | Activity #n
1151 * | | Restart messages block
1154 * | | Comments block
1158 struct report_format {
1160 * This variable contains the identification value (F_...) for this report format.
1164 * Format options (FO_...).
1166 unsigned int options;
1168 * This function displays the report header
1169 * (data displayed once at the beginning of the report).
1171 __printf_funct_t (*f_header) (void *, int, char *, struct file_magic *, struct file_header *,
1172 struct activity * [], unsigned int [], struct file_activity *);
1174 * This function defines the statistics part of the report.
1175 * Used only with textual (XML-like) reports and PCP archives.
1177 __printf_funct_t (*f_statistics) (int *, int, struct activity * [], unsigned int []);
1179 * This function defines the timestamp part of the report.
1180 * Used only with textual (XML-like) reports, PCP archives and RAW output format.
1182 __tm_funct_t (*f_timestamp) (void *, int, char *, char *, unsigned long long,
1183 struct record_header *, struct file_header *, unsigned int);
1185 * This function displays the restart messages.
1187 __printf_funct_t (*f_restart) (int *, int, char *, char *, int,
1188 struct file_header *, struct record_header *);
1190 * This function displays the comments.
1192 __printf_funct_t (*f_comment) (int *, int, char *, char *, int, char *,
1193 struct file_header *, struct record_header *);
1195 * This is the main function used to display all the statistics for current format.
1197 void (*f_display) (int, char *, struct file_activity *, struct file_magic *,
1198 struct tm *, void *);
1202 /* Possible actions for functions used to display reports */
1203 #define F_BEGIN 0x01
1208 ***************************************************************************
1209 * SVG output definitions
1210 ***************************************************************************
1215 * 1 | General header
1218 * 9 | One line from table of contents (if any)
1221 * | | 4 | Graph title
1231 * | | v |-------------------------------
1233 * | v <---><------------------------------>
1236 * v<---------------------------------------------------------------> Gap
1238 * <--------------------------------------------------------------------->
1243 #define SVG_G_XSIZE 720
1245 #define SVG_M_XSIZE 70
1247 #define SVG_V_XSIZE 1050
1249 #define SVG_T_XSIZE 1060
1252 #define SVG_G_YSIZE 200
1254 #define SVG_H_YSIZE 60
1256 #define SVG_M_YSIZE 50
1258 #define SVG_T_YSIZE 310
1260 #define SVG_V_YSIZE 300
1262 #define SVG_C_YSIZE 20
1264 /* Grid: Nr of horizontal lines */
1265 #define SVG_H_GRIDNR 3
1266 /* Grid: Nr of vertical lines */
1267 #define SVG_V_GRIDNR 10
1269 /* Block size used to allocate arrays for graphs data */
1270 #define CHUNKSIZE 4096
1272 /* Maximum number of views on a single row */
1273 #define MAX_VIEWS_ON_A_ROW 6
1275 #define SVG_LINE_GRAPH 1
1276 #define SVG_BAR_GRAPH 2
1278 /* Maximum number of horizontal lines for the background grid */
1279 #define MAX_HLINES_NR 10
1281 /* Color palette constants */
1282 #define SVG_COLORS_IDX_MASK 0x0f
1283 #define SVG_COL_PALETTE_SIZE 24
1284 #define SVG_COL_PALETTE_NR 3
1285 #define SVG_COL_BCKGRD_IDX 16
1286 #define SVG_COL_AXIS_IDX 17
1287 #define SVG_COL_GRID_IDX 18
1288 #define SVG_COL_TITLE_IDX 19
1289 #define SVG_COL_INFO_IDX 20
1290 #define SVG_COL_DEFAULT_IDX 21
1291 #define SVG_COL_HEADER_IDX 22
1292 #define SVG_COL_ERROR_IDX 23
1294 #define SVG_DEFAULT_COL_PALETTE 0
1295 #define SVG_CUSTOM_COL_PALETTE 1
1296 #define SVG_BW_COL_PALETTE 2
1301 ***************************************************************************
1302 * Macro functions definitions.
1304 * Note: Using 'do ... while' makes the macros safer to use
1305 * (remember that macro use is followed by a semicolon).
1306 ***************************************************************************
1309 /* Close file descriptors */
1310 #define CLOSE_ALL(_fd_) do { \
1315 #define CLOSE(_fd_) if (_fd_ >= 0) \
1320 ***************************************************************************
1321 * Various structure definitions.
1322 ***************************************************************************
1325 /* Structure for timestamps */
1333 /* Structure for items in list */
1336 struct sa_item *next;
1341 ***************************************************************************
1342 * Functions prototypes.
1343 ***************************************************************************
1347 * Prototypes used to count new items
1349 __nr_t count_new_int
1350 (struct activity *, int);
1351 __nr_t count_new_net_dev
1352 (struct activity *, int);
1353 __nr_t count_new_net_edev
1354 (struct activity *, int);
1355 __nr_t count_new_filesystem
1356 (struct activity *, int);
1357 __nr_t count_new_fchost
1358 (struct activity *, int);
1359 __nr_t count_new_disk
1360 (struct activity *, int);
1362 /* Functions used to count number of items */
1363 __nr_t wrap_get_cpu_nr
1364 (struct activity *);
1365 __nr_t wrap_get_irq_nr
1366 (struct activity *);
1367 __nr_t wrap_get_serial_nr
1368 (struct activity *);
1369 __nr_t wrap_get_disk_nr
1370 (struct activity *);
1371 __nr_t wrap_get_iface_nr
1372 (struct activity *);
1373 __nr_t wrap_get_fan_nr
1374 (struct activity *);
1375 __nr_t wrap_get_temp_nr
1376 (struct activity *);
1377 __nr_t wrap_get_in_nr
1378 (struct activity *);
1379 __nr_t wrap_get_freq_nr
1380 (struct activity *);
1381 __nr_t wrap_get_usb_nr
1382 (struct activity *);
1383 __nr_t wrap_get_filesystem_nr
1384 (struct activity *);
1385 __nr_t wrap_get_fchost_nr
1386 (struct activity *);
1387 __nr_t wrap_detect_psi
1388 (struct activity *);
1390 /* Functions used to read activities statistics */
1391 __read_funct_t wrap_read_stat_cpu
1392 (struct activity *);
1393 __read_funct_t wrap_read_stat_pcsw
1394 (struct activity *);
1395 __read_funct_t wrap_read_stat_irq
1396 (struct activity *);
1397 __read_funct_t wrap_read_swap
1398 (struct activity *);
1399 __read_funct_t wrap_read_paging
1400 (struct activity *);
1401 __read_funct_t wrap_read_io
1402 (struct activity *);
1403 __read_funct_t wrap_read_meminfo
1404 (struct activity *);
1405 __read_funct_t wrap_read_kernel_tables
1406 (struct activity *);
1407 __read_funct_t wrap_read_loadavg
1408 (struct activity *);
1409 __read_funct_t wrap_read_tty_driver_serial
1410 (struct activity *);
1411 __read_funct_t wrap_read_disk
1412 (struct activity *);
1413 __read_funct_t wrap_read_net_dev
1414 (struct activity *);
1415 __read_funct_t wrap_read_net_edev
1416 (struct activity *);
1417 __read_funct_t wrap_read_net_nfs
1418 (struct activity *);
1419 __read_funct_t wrap_read_net_nfsd
1420 (struct activity *);
1421 __read_funct_t wrap_read_net_sock
1422 (struct activity *);
1423 __read_funct_t wrap_read_net_ip
1424 (struct activity *);
1425 __read_funct_t wrap_read_net_eip
1426 (struct activity *);
1427 __read_funct_t wrap_read_net_icmp
1428 (struct activity *);
1429 __read_funct_t wrap_read_net_eicmp
1430 (struct activity *);
1431 __read_funct_t wrap_read_net_tcp
1432 (struct activity *);
1433 __read_funct_t wrap_read_net_etcp
1434 (struct activity *);
1435 __read_funct_t wrap_read_net_udp
1436 (struct activity *);
1437 __read_funct_t wrap_read_net_sock6
1438 (struct activity *);
1439 __read_funct_t wrap_read_net_ip6
1440 (struct activity *);
1441 __read_funct_t wrap_read_net_eip6
1442 (struct activity *);
1443 __read_funct_t wrap_read_net_icmp6
1444 (struct activity *);
1445 __read_funct_t wrap_read_net_eicmp6
1446 (struct activity *);
1447 __read_funct_t wrap_read_net_udp6
1448 (struct activity *);
1449 __read_funct_t wrap_read_cpuinfo
1450 (struct activity *);
1451 __read_funct_t wrap_read_fan
1452 (struct activity *);
1453 __read_funct_t wrap_read_temp
1454 (struct activity *);
1455 __read_funct_t wrap_read_in
1456 (struct activity *);
1457 __read_funct_t wrap_read_meminfo_huge
1458 (struct activity *);
1459 __read_funct_t wrap_read_cpu_wghfreq
1460 (struct activity *);
1461 __read_funct_t wrap_read_bus_usb_dev
1462 (struct activity *);
1463 __read_funct_t wrap_read_filesystem
1464 (struct activity *);
1465 __read_funct_t wrap_read_fchost
1466 (struct activity *);
1467 __read_funct_t wrap_read_softnet
1468 (struct activity *);
1469 __read_funct_t wrap_read_psicpu
1470 (struct activity *);
1471 __read_funct_t wrap_read_psiio
1472 (struct activity *);
1473 __read_funct_t wrap_read_psimem
1474 (struct activity *);
1476 /* Other functions */
1477 int check_alt_sa_dir
1479 void enum_version_nr
1480 (struct file_magic *);
1482 (struct activity * [], unsigned int, int);
1483 int get_activity_position
1484 (struct activity * [], unsigned int, int);
1485 void handle_invalid_sa_file
1486 (int, struct file_magic *, char *, int);
1487 void print_collect_error
1489 void set_default_file
1491 int skip_extra_struct
1494 (int, const void *, int);
1498 (struct sa_item **, char *, int);
1499 void allocate_bitmaps
1500 (struct activity * []);
1501 void allocate_structures
1502 (struct activity * []);
1504 (struct activity *, int, int, int);
1505 void check_file_actlst
1506 (int *, char *, struct activity * [], uint64_t, struct file_magic *,
1507 struct file_header *, struct file_activity **, unsigned int [], int *, int *);
1508 int check_net_dev_reg
1509 (struct activity *, int, int, int);
1510 int check_net_edev_reg
1511 (struct activity *, int, int, int);
1512 double compute_ifutil
1513 (struct stats_net_dev *, double, double);
1514 void copy_structures
1515 (struct activity * [], unsigned int [], struct record_header [], int, int);
1517 (struct tm *, struct tstamp *, int);
1518 void display_sa_file_version
1519 (FILE *, struct file_magic *);
1521 (struct activity * []);
1522 void free_structures
1523 (struct activity * []);
1525 (unsigned int, unsigned int);
1526 char *get_sa_devname
1527 (unsigned int, unsigned int, unsigned long long [], unsigned int, uint64_t);
1528 void get_file_timestamp_struct
1529 (uint64_t, struct tm *, struct file_header *);
1530 char *get_fs_name_to_display
1531 (struct activity *, uint64_t, struct stats_filesystem *);
1532 unsigned long long get_global_cpu_statistics
1533 (struct activity *, int, int, uint64_t, unsigned char []);
1534 void get_global_int_statistics
1535 (struct activity *, int, int, uint64_t, unsigned char []);
1536 void get_global_soft_statistics
1537 (struct activity *, int, int, uint64_t, unsigned char []);
1539 (struct record_header *, struct record_header *, unsigned long long *);
1540 void init_custom_color_palette
1543 (unsigned long long, unsigned long long, int, long);
1544 void parse_sa_devices
1545 (char *, struct activity *, int, int *, int, int);
1547 (char * [], int *, struct activity * [], uint64_t *, int);
1549 (char * [], int *, uint64_t *, struct activity * []);
1551 (char * [], int *, struct activity * []);
1553 (char * [], int *, struct activity * []);
1555 (char * [], int *, struct activity * []);
1557 (char * [], int *, struct tstamp *, const char *);
1558 void print_report_hdr
1559 (uint64_t, struct tm *, struct file_header *);
1560 void print_sar_comment
1561 (int *, int, char *, char *, int, char *, struct file_header *,
1562 struct record_header *);
1563 __printf_funct_t print_sar_restart
1564 (int *, int, char *, char *, int, struct file_header *, struct record_header *);
1565 int print_special_record
1566 (struct record_header *, uint64_t, struct tstamp *, struct tstamp *,
1567 int, int, struct tm *, char *, int, struct file_magic *,
1568 struct file_header *, struct activity * [], struct report_format *, int, int);
1569 int read_file_stat_bunch
1570 (struct activity * [], int, int, int, struct file_activity *, int, int,
1571 char *, struct file_magic *, int);
1572 __nr_t read_nr_value
1573 (int, char *, struct file_magic *, int, int, int);
1575 (int, void *, struct record_header *, struct file_header *, int, int,
1576 int, size_t, uint64_t, struct report_format *);
1577 void reallocate_all_buffers
1578 (struct activity *, __nr_t);
1581 void replace_nonprintable_char
1584 (int, void *, size_t, int, int);
1585 int sa_get_record_timestamp_struct
1586 (uint64_t, struct record_header *, struct tm *);
1587 int sa_open_read_magic
1588 (int *, char *, struct file_magic *, int, int *, int);
1589 int search_list_item
1590 (struct sa_item *, char *);
1591 void select_all_activities
1592 (struct activity * []);
1593 void select_default_activity
1594 (struct activity * []);
1596 (struct activity * [], uint64_t *);
1597 void set_hdr_rectime
1598 (unsigned int, struct tm *, struct file_header *);
1599 void set_record_timestamp_string
1600 (uint64_t, struct record_header *, char *, char *, int, struct tm *);
1602 (unsigned int [], void *, int);
1603 #endif /* SOURCE_SADC undefined */