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
306 #define ALL_ACTIVITIES ~0U
307 #define EXIT_IF_NOT_FOUND 1
308 #define RESUME_IF_NOT_FOUND 0
316 #define END_OF_DATA_UNEXPECTED 1
317 #define INCONSISTENT_INPUT_DATA 2
322 #define CLOSE_XML_MARKUP 0
323 #define OPEN_XML_MARKUP 1
325 #define CLOSE_JSON_MARKUP 0
326 #define OPEN_JSON_MARKUP 1
328 #define COUNT_ACTIVITIES 0
329 #define COUNT_OUTPUTS 1
331 /* Type for all functions reading statistics */
332 #define __read_funct_t void
333 /* Type for all functions displaying statistics */
334 #define __print_funct_t void
337 ***************************************************************************
338 * Output formats for sadf
339 ***************************************************************************
342 /* Number of output formats */
346 #define F_SAR_OUTPUT 0
347 #define F_DB_OUTPUT 1
348 #define F_HEADER_OUTPUT 2
349 #define F_PPC_OUTPUT 3
350 #define F_XML_OUTPUT 4
351 #define F_JSON_OUTPUT 5
352 #define F_CONV_OUTPUT 6
353 #define F_SVG_OUTPUT 7
354 #define F_RAW_OUTPUT 8
355 #define F_PCP_OUTPUT 9
358 /* Structure for SVG specific parameters */
360 unsigned long long dt; /* Interval of time for current sample */
361 unsigned long long ust_time_ref; /* X axis start time in seconds since the epoch */
362 unsigned long long ust_time_end; /* X axis end time in seconds since the epoch */
363 unsigned long long ust_time_first; /* Time (in seconds since the epoch) for first sample */
364 int graph_no; /* Total number of views already displayed */
365 int restart; /* TRUE if we have just met a RESTART record */
366 int nr_act_dispd; /* Number of activities that will be displayed */
367 struct file_header *file_hdr; /* Pointer on file header structure */
370 /* Structure used when displaying SVG header */
371 struct svg_hdr_parm {
372 int graph_nr; /* Number of rows of views to display or canvas height entered on the command line */
373 int views_per_row; /* Maximum number of views on a single row */
374 int nr_act_dispd; /* Number of activities that will be displayed */
378 ***************************************************************************
379 * System activity data files
381 * The rule is: "strict writing, read any", meaning that sar/sadc can
382 * only append data to a datafile whose format is strictly the same as that
383 * of current version (checking FORMAT_MAGIC is not enough), but sar/sadf
384 * can read data from different versions, providing that FORMAT_MAGIC value
385 * has not changed (note that we are talking here of data read from a file,
386 * not data that sar reads from sadc, in which case the "strict" rule applies).
388 * Format of system activity data files:
391 * | file_magic structure
395 * | file_header structure
399 * | file_activity structure | x file_header:sa_act_nr
403 * | extra_desc structure (exists only if file_header:extra_next != 0)
407 * | unknown extra structure(s) | x extra_desc:extra_nr
411 * | (extra_desc structure (exists only if previous extra_desc:extra_next != 0))
419 * | record_header structure |
423 * | extra_desc structure (exists only if record_header:extra_next != 0)
427 * | unknown extra structure(s) | x extra_desc:extra_nr
431 * | (extra_desc structure (exists only if previous extra_desc:extra_next != 0))
441 * | Statistics structure(s) | x <count>
447 * | Statistics structure(s)... |
451 * Note: For activities with varying number of items, a __nr_t value, giving
452 * the number of items, arrives before the statistics structures so that
453 * we know how many of them have to be read.
454 * NB: This value exists for all the activities even if they share the same
455 * count function (e.g. A_NET_DEV and A_NET_EDEV). Indeed, statistics are not
456 * read atomically and the number of items (e.g. network interfaces) may have
459 * If the record header's type is R_COMMENT then we find only a comment
460 * following the record_header structure.
462 * If the record_header's type is R_RESTART then we find only the number of CPU
463 * (of type __nr_t) of the machine following the record_header structure.
464 * This number is 1 for 1 CPU and not an SMP kernel (CPU "all"),
465 * 2 for 1 CPU and SMP kernel (CPU "all" and CPU 0), etc.
466 * Of course we display the real number of CPU (e.g. "1" for 1 CPU and SMP
467 * kernel) with the LINUX RESTART message.
469 * If the record_header's type is R_EXTRA* then we find only a list of extra
470 * structures following the record_header structure but no statistics ones.
471 * Note that extra structures may exist for all record_header types
472 * (R_STATS, R_COMMENT, R_RESTART...). For R_COMMENT and R_RESTART records,
473 * the extra structures will be found after the comment or the number of CPU.
474 ***************************************************************************
478 * Sysstat magic number. Should never be modified.
479 * Indicate that the file was created by sysstat.
481 #define SYSSTAT_MAGIC 0xd596
482 #define SYSSTAT_MAGIC_SWAPPED (((SYSSTAT_MAGIC << 8) | (SYSSTAT_MAGIC >> 8)) & 0xffff)
485 * Datafile format magic number.
486 * Modified to indicate that the format of the file is
487 * no longer compatible with that of previous sysstat versions.
489 #define FORMAT_MAGIC 0x2175
490 #define FORMAT_MAGIC_SWAPPED (((FORMAT_MAGIC << 8) | (FORMAT_MAGIC >> 8)) & 0xffff)
492 /* Previous datafile format magic numbers used by older sysstat versions */
493 #define FORMAT_MAGIC_2171 0x2171
494 #define FORMAT_MAGIC_2171_SWAPPED (((FORMAT_MAGIC_2171 << 8) | (FORMAT_MAGIC_2171 >> 8)) & 0xffff)
495 #define FORMAT_MAGIC_2173 0x2173
496 #define FORMAT_MAGIC_2173_SWAPPED (((FORMAT_MAGIC_2173 << 8) | (FORMAT_MAGIC_2173 >> 8)) & 0xffff)
498 /* Padding in file_magic structure. See below. */
499 #define FILE_MAGIC_PADDING 48
501 /* Structure for file magic header data */
504 * This field identifies the file as a file created by sysstat.
506 unsigned short sysstat_magic;
508 * The value of this field varies whenever datafile format changes.
510 unsigned short format_magic;
512 * Sysstat version used to create the file.
514 unsigned char sysstat_version;
515 unsigned char sysstat_patchlevel;
516 unsigned char sysstat_sublevel;
517 unsigned char sysstat_extraversion;
518 #define FILE_MAGIC_ULL_NR 0 /* Nr of unsigned long long below */
519 #define FILE_MAGIC_UL_NR 0 /* Nr of unsigned long below */
520 #define FILE_MAGIC_U_NR 5 /* Nr of [unsigned] int below */
522 * Size of file's header (size of file_header structure used by file).
524 unsigned int header_size;
526 * Set to non zero if data file has been converted with "sadf -c" from
527 * an old format (version x.y.z) to a newest format (version X.Y.Z).
528 * In this case, the value is: Y*256 + Z + 1.
529 * The FORMAT_MAGIC value of the file can be used to determine X.
531 unsigned int upgraded;
533 * Description of the file_header structure
534 * (nr of "long long", nr of "long" and nr of "int").
536 unsigned int hdr_types_nr[3];
538 * Padding. Reserved for future use while avoiding a format change.
539 * sysstat always reads a number of bytes which is that expected for
540 * current sysstat version (FILE_MAGIC_SIZE). We cannot guess if we
541 * are going to read a file from current, an older or a newer version.
543 unsigned char pad[FILE_MAGIC_PADDING];
546 #define FILE_MAGIC_SIZE (sizeof(struct file_magic))
548 /* Header structure for system activity data file */
551 * Timestamp in seconds since the epoch.
553 unsigned long long sa_ust_time;
555 * Number of jiffies per second.
557 unsigned long sa_hz __attribute__ ((aligned (8)));
559 * Number of [online or offline] CPU (1 .. CPU_NR + 1)
560 * when the datafile has been created.
561 * When reading a datafile, this value is updated (in memory)
562 * whenever a RESTART record is found.
563 * When writing or appending data to a file, this field is updated
564 * neither in file nor in memory.
566 unsigned int sa_cpu_nr __attribute__ ((aligned (8)));
568 * Number of activities saved in file.
570 unsigned int sa_act_nr;
576 * Description of the file_activity and record_header structures
577 * (nr of "long long", nr of "long" and nr of "int").
579 unsigned int act_types_nr[3];
580 unsigned int rec_types_nr[3];
582 * Size of file_activity and record_header structures used by file.
584 unsigned int act_size;
585 unsigned int rec_size;
587 * TRUE if an extra_desc structure exists.
589 unsigned int extra_next;
591 * Current day and month.
592 * No need to save DST (Daylight Saving Time) flag, since it is not taken
593 * into account by the strftime() function used to print the timestamp.
595 unsigned char sa_day;
596 unsigned char sa_month;
598 * Size of a long integer. Useful to know the architecture on which
599 * the datafile was created.
603 * Operating system name.
605 char sa_sysname[UTSNAME_LEN];
609 char sa_nodename[UTSNAME_LEN];
611 * Operating system release number.
613 char sa_release[UTSNAME_LEN];
615 * Machine architecture.
617 char sa_machine[UTSNAME_LEN];
621 char sa_tzname[TZNAME_LEN];
624 #define FILE_HEADER_SIZE (sizeof(struct file_header))
625 #define FILE_HEADER_ULL_NR 1 /* Nr of unsigned long long in file_header structure */
626 #define FILE_HEADER_UL_NR 1 /* Nr of unsigned long in file_header structure */
627 #define FILE_HEADER_U_NR 12 /* Nr of [unsigned] int in file_header structure */
628 /* The values below are used for sanity check */
629 #define MIN_FILE_HEADER_SIZE 0
630 #define MAX_FILE_HEADER_SIZE 8192
634 * Base magical number for activities.
636 #define ACTIVITY_MAGIC_BASE 0x8a
638 * Magical value used for activities with
639 * unknown format (used for sadf -H only).
641 #define ACTIVITY_MAGIC_UNKNOWN 0x89
643 /* List of activities saved in file */
644 struct file_activity {
646 * Identification value of activity.
650 * Activity magical number.
654 * Number of items for this activity
655 * when the data file has been created.
659 * Number of sub-items for this activity.
663 * Set to TRUE if statistics are preceded by
664 * a value giving the number of structures to read.
668 * Size of an item structure.
672 * Description of the structure containing statistics for the
673 * given activity (nr of "long long", nr of "long" and nr of "int").
675 unsigned int types_nr[3];
678 #define FILE_ACTIVITY_SIZE (sizeof(struct file_activity))
679 #define MAX_FILE_ACTIVITY_SIZE 1024 /* Used for sanity check */
680 #define FILE_ACTIVITY_ULL_NR 0 /* Nr of unsigned long long in file_activity structure */
681 #define FILE_ACTIVITY_UL_NR 0 /* Nr of unsigned long in file_activity structure */
682 #define FILE_ACTIVITY_U_NR 9 /* Nr of [unsigned] int in file_activity structure */
684 #define MAX_ITEM_STRUCT_SIZE 1024 /* Used for sanity check */
687 * Description of an extra structure.
688 * The composition of this structure should not change in time.
692 * Number of extra structures to read.
694 unsigned int extra_nr;
696 * Size of an extra structure.
698 unsigned int extra_size;
700 * TRUE if another extra_desc structure exists after
701 * all the extra structures.
703 unsigned int extra_next;
705 * Description of an extra structure
706 * (nr of "long long", nr of "long" and nr of "int").
708 unsigned int extra_types_nr[3];
711 #define EXTRA_DESC_SIZE (sizeof(struct extra_desc))
712 #define EXTRA_DESC_ULL_NR 0 /* Nr of unsigned long long in extra_desc structure */
713 #define EXTRA_DESC_UL_NR 0 /* Nr of unsigned long in extra_desc structure */
714 #define EXTRA_DESC_U_NR 6 /* Nr of [unsigned] int in extra_desc structure */
715 #define MAX_EXTRA_NR 8192
716 #define MAX_EXTRA_SIZE 1024
720 * R_STATS means that this is a record of statistics.
724 * R_RESTART means that this is a special record containing
725 * a LINUX RESTART message.
729 * R_LAST_STATS warns sar that this is the last record to be written
730 * to file before a file rotation, and that the next data to come will
732 * Such a record is tagged R_STATS anyway before being written to file.
734 #define R_LAST_STATS 3
736 * R_COMMENT means that this is a special record containing
741 * R_EXTRA* records means that extra structures are following current
742 * record_header structure, but no statistics structures.
744 #define R_EXTRA_MIN 5
745 #define R_EXTRA_MAX 15
747 /* Maximum length of a comment */
748 #define MAX_COMMENT_LEN 64
750 /* Header structure for every record */
751 struct record_header {
753 * Machine uptime in 1/100th of a second.
755 unsigned long long uptime_cs;
757 * Timestamp (number of seconds since the epoch).
759 unsigned long long ust_time;
761 * TRUE if an extra_desc structure exists.
763 unsigned int extra_next;
765 * Record type: R_STATS, R_RESTART,...
767 unsigned char record_type;
769 * Timestamp: Hour (0-23), minute (0-59) and second (0-60).
770 * Used to determine TRUE time.
771 * Hour value depends in fact on timezone (TZ variable) value.
774 unsigned char minute;
775 unsigned char second;
778 #define RECORD_HEADER_SIZE (sizeof(struct record_header))
779 #define MAX_RECORD_HEADER_SIZE 512 /* Used for sanity check */
780 #define RECORD_HEADER_ULL_NR 2 /* Nr of unsigned long long in record_header structure */
781 #define RECORD_HEADER_UL_NR 0 /* Nr of unsigned long in record_header structure */
782 #define RECORD_HEADER_U_NR 1 /* Nr of unsigned int in record_header structure */
786 ***************************************************************************
787 * Generic description of an activity.
788 ***************************************************************************
791 /* Activity options */
794 * Indicate that corresponding activity should be collected by sadc.
796 #define AO_COLLECTED 0x01
798 * Indicate that corresponding activity should be displayed by sar.
800 #define AO_SELECTED 0x02
802 * Indicate that corresponding activity has items that need to be counted.
803 * This means that its @f_count_index values is >= 0.
804 * (We use AO_COUNTED instead of @f_count_index because @f_count_index
805 * is available (initialized) only for sadc).
807 #define AO_COUNTED 0x04
809 * Indicate that activity's metrics have persistent values when devices
810 * are registered again (this means that when the device is registered again,
811 * the metrics pick the values they had when they had been unregistered).
812 * Exclusively used for CPU related statistics at the present time
813 * (e.g. A_CPU and A_NET_SOFT).
815 #define AO_PERSISTENT 0x08
817 * This flag should be set for every activity closing a markup used
818 * by several activities. Used by sadf f_xml_print() functions to
819 * display XML output, and also by f_json_print() functions to display JSON output.
821 #define AO_CLOSE_MARKUP 0x10
823 * Indicate that corresponding activity has multiple different
824 * output formats. This is the case for example for memory activity
825 * with options -r and -R.
826 * PS: Such an activity should appear in the list of activities that
827 * sar -A is supposed to display.
829 #define AO_MULTIPLE_OUTPUTS 0x20
831 * Indicate that one (SVG) graph will be displayed for each
832 * distinct item for this activity (sadf -g).
834 #define AO_GRAPH_PER_ITEM 0x40
836 * Indicate that this activity may have sub-items.
838 #define AO_MATRIX 0x80
840 * Indicate that a list of devices has been entered on the command
841 * line for this activity (see options --dev=, --iface=, ...)
843 #define AO_LIST_ON_CMDLINE 0x100
845 * Indicate that the number of items for this activity should always
846 * be counted, even if the activity is not collected.
848 #define AO_ALWAYS_COUNTED 0x200
850 * Indicate that corresponding activity should be collected only
851 * if a test has been successfully passed before.
852 * The test corresponds to the count() function (see @f_count_index).
853 * This is intended for activities with a fixed number of items but
854 * whose {/proc|/sys} files are not necessarily available, e.g. depending
855 * on the kernel version used. Unlike activities with AO_COUNTED flag,
856 * those having AO_DETECTED flag won't have a @has_nr number preceding
857 * their statistics structures in datafile.
859 #define AO_DETECTED 0x400
861 #define IS_COLLECTED(m) (((m) & AO_COLLECTED) == AO_COLLECTED)
862 #define IS_SELECTED(m) (((m) & AO_SELECTED) == AO_SELECTED)
863 #define HAS_COUNT_FUNCTION(m) (((m) & AO_COUNTED) == AO_COUNTED)
864 #define HAS_DETECT_FUNCTION(m) (((m) & AO_DETECTED) == AO_DETECTED)
865 #define HAS_PERSISTENT_VALUES(m) (((m) & AO_PERSISTENT) == AO_PERSISTENT)
866 #define CLOSE_MARKUP(m) (((m) & AO_CLOSE_MARKUP) == AO_CLOSE_MARKUP)
867 #define HAS_MULTIPLE_OUTPUTS(m) (((m) & AO_MULTIPLE_OUTPUTS) == AO_MULTIPLE_OUTPUTS)
868 #define ONE_GRAPH_PER_ITEM(m) (((m) & AO_GRAPH_PER_ITEM) == AO_GRAPH_PER_ITEM)
869 #define IS_MATRIX(m) (((m) & AO_MATRIX) == AO_MATRIX)
870 #define HAS_LIST_ON_CMDLINE(m) (((m) & AO_LIST_ON_CMDLINE) == AO_LIST_ON_CMDLINE)
871 #define ALWAYS_COUNT_ITEMS(m) (((m) & AO_ALWAYS_COUNTED) == AO_ALWAYS_COUNTED)
876 /* Structure used to define a bitmap needed by an activity */
879 * Bitmap for activities that need one. Remember to allocate it
882 unsigned char *b_array;
884 * Size of the bitmap in bits. In fact, bitmap is sized to b_size + 1
885 * to take into account CPU "all"
891 * Structure used to define an activity.
892 * Note: This structure can be modified without changing the format of data files.
896 * This variable contains the identification value (A_...) for this activity.
900 * Activity options (AO_...)
902 unsigned int options;
904 * Activity magical number. This number changes when activity format in file
905 * is no longer compatible with the format of that same activity from
910 * An activity belongs to a group (and only one).
911 * Groups are those selected with option -S of sadc.
915 * Index in f_count[] array to determine function used to count
916 * the number of items (serial lines, network interfaces, etc.) for
917 * activities with AO_COUNTED flag. Determine @nr value.
918 * Such a function should _always_ return a value greater than
921 * A value of -1 indicates that the number of items
922 * is a constant (and @nr_ini is set to this value).
924 * This function may be called even if corresponding activity has not
925 * been selected if flag AO_ALWAYS_COUNTED is set, to make sure that
926 * all items have been calculated (e.g. #CPU)
928 * The count() function may also be used to know if an activity (with
929 * AO_DETECTED flag) can actually be collected based on the presence of
930 * {/proc|/sys} files.
934 * Index in f_count[] array to determine function used to count the
935 * number of sub-items -> @nr2
936 * Such a function should _always_ return a value greater than
939 * A value of -1 indicates that the number of items is a constant
940 * (and @nr2 is set to this value).
944 * This function reads the relevant file and fill the buffer
945 * with statistics corresponding to given activity.
947 __read_funct_t (*f_read) (struct activity *);
949 * This function displays activity statistics onto the screen.
951 __print_funct_t (*f_print) (struct activity *, int, int, unsigned long long);
953 * This function displays average activity statistics onto the screen.
955 __print_funct_t (*f_print_avg) (struct activity *, int, int, unsigned long long);
957 * This function is used by sadf to display activity in a format that can
958 * easily be ingested by a relational database, or a format that can be
959 * handled by pattern processing commands like "awk".
961 __print_funct_t (*f_render) (struct activity *, int, char *, int, unsigned long long);
963 * This function is used by sadf to display activity statistics in XML.
965 __print_funct_t (*f_xml_print) (struct activity *, int, int, unsigned long long);
967 * This function is used by sadf to display activity statistics in JSON.
969 __print_funct_t (*f_json_print) (struct activity *, int, int, unsigned long long);
971 * This function is used by sadf to display activity statistics in SVG.
973 __print_funct_t (*f_svg_print) (struct activity *, int, int, struct svg_parm *,
974 unsigned long long, struct record_header *);
976 * This function is used by sadf to display activity statistics in raw format.
978 __print_funct_t (*f_raw_print) (struct activity *, char *, int);
980 * This function is used by sadf to display activity statistics in PCP format.
982 __print_funct_t (*f_pcp_print) (struct activity *, int);
984 * This function is used by sadf to count the number of new items in current
985 * sample and add them to the linked list @item_list.
987 __nr_t (*f_count_new) (struct activity *, int);
989 * Linked list containing item names. This is either all the different items
990 * found in a file for activities that have a @f_count_new() function (used by sadf),
991 * or a list entered on the command line (used by sadf and sar).
993 struct sa_item *item_list;
995 * Number of different items found in file (calculated by sadf).
996 * This is also the number of items in @item_list if this list exists.
1000 * Header string displayed by sadf -d.
1001 * Header lines for each output (for activities with multiple outputs) are
1002 * separated with a '|' character.
1003 * For a given output, the first field corresponding to extended statistics
1004 * (eg. -r ALL) begins with a '&' character.
1008 * Description of activity.
1016 * Description of the corresponding structure containing statistics (as defined
1017 * in rd_stats.h or rd_sensors.h). Such a structure has 0+ fields of type
1018 * "long long", followed by 0+ fields of type "long", followed by 0+ fields of
1019 * type "int", followed by 0+ other fields (e.g. of type char). The array below
1020 * gives the number of "long long" fields composing the structure, then the number
1021 * of "long" fields, then the number of "int" fields.
1023 unsigned int gtypes_nr[3];
1025 * This array has the same meaning as @gtypes_nr[] above, but the values are those
1026 * read from current data file. They may be different from those of @gtypes_nr[]
1027 * because we can read data from a different sysstat version (older or newer).
1029 unsigned int ftypes_nr[3];
1031 * Number of SVG graphs for this activity. The total number of graphs for
1032 * the activity can be greater though if flag AO_GRAPH_PER_ITEM is set, in
1033 * which case the total number will be @g_nr * @nr.
1037 * Number of items on the system, as counted when the system is initialized.
1038 * A negative value (-1) is the default value and indicates that this number
1039 * has still not been calculated by the function whose index is in @f_count_index.
1040 * A value of 0 means that this number has been calculated, but no items have
1042 * A positive value (>0) has either been calculated or is a constant.
1046 * Number of sub-items on the system.
1047 * @nr2 is in fact the second dimension of a matrix of items, the first
1048 * one being @nr. @nr is the number of lines, and @nr2 the number of columns.
1049 * A negative value (-1) is the default value and indicates that this number
1050 * has still not been calculated by the f_count2() function.
1051 * A value of 0 means that this number has been calculated, but no sub-items have
1053 * A positive value (>0) has either been calculated or is a constant.
1055 * 1) IF @nr2 = 0 THEN @nr_ini = 0
1056 * Note: If @nr_ini = 0, then @nr2 is undetermined (may be -1, 0 or >0).
1057 * 2) IF @nr_ini > 0 THEN @nr2 > 0.
1058 * Note: If @nr2 > 0 then @nr_ini is undetermined (may be -1, 0 or >0).
1059 * 3) IF @nr_ini <= 0 THEN @nr2 = -1 (this is the default value for @nr2,
1060 * meaning that it has not been calculated).
1064 * Maximum number of elements that sar can handle for this item.
1065 * NB: The maximum number of elements that sar can handle for sub-items
1070 * Number of items, as read and saved in corresponding buffer (@buf: See below).
1071 * The value may be zero for a particular sample if no items have been found.
1075 * Number of structures allocated in @buf[*]. This number should be greater
1076 * than or equal to @nr[*].
1078 __nr_t nr_allocated;
1081 * This is the size of the corresponding structure, as read from or written
1082 * to a file, or read from or written by the data collector.
1087 * This is the size of the corresponding structure as mapped into memory.
1088 * @msize can be different from @fsize when data are read from or written to
1089 * a data file from a different sysstat version.
1093 * Optional flags for activity. This is eg. used when AO_MULTIPLE_OUTPUTS
1095 * 0x0001 - 0x0080 : Multiple outputs (eg. AO_F_MEMORY, AO_F_SWAP...)
1096 * 0x0100 - 0x8000 : If bit set then display complete header (@hdr_line) for
1097 * corresponding output
1098 * 0x010000+ : Optional flags
1100 unsigned int opt_flags;
1102 * Buffers that will contain the statistics read. Its size is @nr * @nr2 * @size each.
1103 * [0]: used by sadc.
1104 * [0] and [1]: current/previous statistics values (used by sar).
1105 * [2]: Used by sar to save first collected stats (used later to
1110 * Bitmap for activities that need one. Such a bitmap is needed by activity
1111 * if @bitmap is not NULL.
1113 struct act_bitmap *bitmap;
1118 ***************************************************************************
1119 * Generic description of an output format for sadf (and sar).
1120 ***************************************************************************
1123 /* Type for all functions used by sadf to display stats in various formats */
1124 #define __printf_funct_t void
1125 #define __tm_funct_t char *
1128 * Structure used to define a report.
1129 * A XML-like report has the following format:
1135 * | | Statistics block
1138 * | | | Timestamp block
1141 * | | | | Activity #1
1147 * | | | | Activity #n
1152 * | | Restart messages block
1155 * | | Comments block
1159 struct report_format {
1161 * This variable contains the identification value (F_...) for this report format.
1165 * Format options (FO_...).
1167 unsigned int options;
1169 * This function displays the report header
1170 * (data displayed once at the beginning of the report).
1172 __printf_funct_t (*f_header) (void *, int, char *, struct file_magic *, struct file_header *,
1173 struct activity * [], unsigned int [], struct file_activity *);
1175 * This function defines the statistics part of the report.
1176 * Used only with textual (XML-like) reports and PCP archives.
1178 __printf_funct_t (*f_statistics) (int *, int, struct activity * [], unsigned int []);
1180 * This function defines the timestamp part of the report.
1181 * Used only with textual (XML-like) reports, PCP archives and RAW output format.
1183 __tm_funct_t (*f_timestamp) (void *, int, char *, char *, unsigned long long,
1184 struct record_header *, struct file_header *, unsigned int);
1186 * This function displays the restart messages.
1188 __printf_funct_t (*f_restart) (int *, int, char *, char *, int,
1189 struct file_header *, struct record_header *);
1191 * This function displays the comments.
1193 __printf_funct_t (*f_comment) (int *, int, char *, char *, int, char *,
1194 struct file_header *, struct record_header *);
1196 * This is the main function used to display all the statistics for current format.
1198 void (*f_display) (int, char *, struct file_activity *, struct file_magic *,
1199 struct tm *, void *);
1203 /* Possible actions for functions used to display reports */
1204 #define F_BEGIN 0x01
1209 ***************************************************************************
1210 * SVG output definitions
1211 ***************************************************************************
1216 * 1 | General header
1219 * 9 | One line from table of contents (if any)
1222 * | | 4 | Graph title
1232 * | | v |-------------------------------
1234 * | v <---><------------------------------>
1237 * v<---------------------------------------------------------------> Gap
1239 * <--------------------------------------------------------------------->
1244 #define SVG_G_XSIZE 720
1246 #define SVG_M_XSIZE 70
1248 #define SVG_V_XSIZE 1050
1250 #define SVG_T_XSIZE 1060
1253 #define SVG_G_YSIZE 200
1255 #define SVG_H_YSIZE 60
1257 #define SVG_M_YSIZE 50
1259 #define SVG_T_YSIZE 310
1261 #define SVG_V_YSIZE 300
1263 #define SVG_C_YSIZE 20
1265 /* Grid: Nr of horizontal lines */
1266 #define SVG_H_GRIDNR 3
1267 /* Grid: Nr of vertical lines */
1268 #define SVG_V_GRIDNR 10
1270 /* Block size used to allocate arrays for graphs data */
1271 #define CHUNKSIZE 4096
1273 /* Maximum number of views on a single row */
1274 #define MAX_VIEWS_ON_A_ROW 6
1276 #define SVG_LINE_GRAPH 1
1277 #define SVG_BAR_GRAPH 2
1279 /* Maximum number of horizontal lines for the background grid */
1280 #define MAX_HLINES_NR 10
1282 /* Color palette constants */
1283 #define SVG_COLORS_IDX_MASK 0x0f
1284 #define SVG_COL_PALETTE_SIZE 24
1285 #define SVG_COL_PALETTE_NR 3
1286 #define SVG_COL_BCKGRD_IDX 16
1287 #define SVG_COL_AXIS_IDX 17
1288 #define SVG_COL_GRID_IDX 18
1289 #define SVG_COL_TITLE_IDX 19
1290 #define SVG_COL_INFO_IDX 20
1291 #define SVG_COL_DEFAULT_IDX 21
1292 #define SVG_COL_HEADER_IDX 22
1293 #define SVG_COL_ERROR_IDX 23
1295 #define SVG_DEFAULT_COL_PALETTE 0
1296 #define SVG_CUSTOM_COL_PALETTE 1
1297 #define SVG_BW_COL_PALETTE 2
1302 ***************************************************************************
1303 * Macro functions definitions.
1305 * Note: Using 'do ... while' makes the macros safer to use
1306 * (remember that macro use is followed by a semicolon).
1307 ***************************************************************************
1310 /* Close file descriptors */
1311 #define CLOSE_ALL(_fd_) do { \
1316 #define CLOSE(_fd_) if (_fd_ >= 0) \
1321 ***************************************************************************
1322 * Various structure definitions.
1323 ***************************************************************************
1326 /* Structure for timestamps */
1334 /* Structure for items in list */
1337 struct sa_item *next;
1342 ***************************************************************************
1343 * Functions prototypes.
1344 ***************************************************************************
1348 * Prototypes used to count new items
1350 __nr_t count_new_net_dev
1351 (struct activity *, int);
1352 __nr_t count_new_net_edev
1353 (struct activity *, int);
1354 __nr_t count_new_filesystem
1355 (struct activity *, int);
1356 __nr_t count_new_fchost
1357 (struct activity *, int);
1358 __nr_t count_new_disk
1359 (struct activity *, int);
1361 /* Functions used to count number of items */
1362 __nr_t wrap_get_cpu_nr
1363 (struct activity *);
1364 __nr_t wrap_get_irq_nr
1365 (struct activity *);
1366 __nr_t wrap_get_serial_nr
1367 (struct activity *);
1368 __nr_t wrap_get_disk_nr
1369 (struct activity *);
1370 __nr_t wrap_get_iface_nr
1371 (struct activity *);
1372 __nr_t wrap_get_fan_nr
1373 (struct activity *);
1374 __nr_t wrap_get_temp_nr
1375 (struct activity *);
1376 __nr_t wrap_get_in_nr
1377 (struct activity *);
1378 __nr_t wrap_get_freq_nr
1379 (struct activity *);
1380 __nr_t wrap_get_usb_nr
1381 (struct activity *);
1382 __nr_t wrap_get_filesystem_nr
1383 (struct activity *);
1384 __nr_t wrap_get_fchost_nr
1385 (struct activity *);
1386 __nr_t wrap_detect_psi
1387 (struct activity *);
1389 /* Functions used to read activities statistics */
1390 __read_funct_t wrap_read_stat_cpu
1391 (struct activity *);
1392 __read_funct_t wrap_read_stat_pcsw
1393 (struct activity *);
1394 __read_funct_t wrap_read_stat_irq
1395 (struct activity *);
1396 __read_funct_t wrap_read_swap
1397 (struct activity *);
1398 __read_funct_t wrap_read_paging
1399 (struct activity *);
1400 __read_funct_t wrap_read_io
1401 (struct activity *);
1402 __read_funct_t wrap_read_meminfo
1403 (struct activity *);
1404 __read_funct_t wrap_read_kernel_tables
1405 (struct activity *);
1406 __read_funct_t wrap_read_loadavg
1407 (struct activity *);
1408 __read_funct_t wrap_read_tty_driver_serial
1409 (struct activity *);
1410 __read_funct_t wrap_read_disk
1411 (struct activity *);
1412 __read_funct_t wrap_read_net_dev
1413 (struct activity *);
1414 __read_funct_t wrap_read_net_edev
1415 (struct activity *);
1416 __read_funct_t wrap_read_net_nfs
1417 (struct activity *);
1418 __read_funct_t wrap_read_net_nfsd
1419 (struct activity *);
1420 __read_funct_t wrap_read_net_sock
1421 (struct activity *);
1422 __read_funct_t wrap_read_net_ip
1423 (struct activity *);
1424 __read_funct_t wrap_read_net_eip
1425 (struct activity *);
1426 __read_funct_t wrap_read_net_icmp
1427 (struct activity *);
1428 __read_funct_t wrap_read_net_eicmp
1429 (struct activity *);
1430 __read_funct_t wrap_read_net_tcp
1431 (struct activity *);
1432 __read_funct_t wrap_read_net_etcp
1433 (struct activity *);
1434 __read_funct_t wrap_read_net_udp
1435 (struct activity *);
1436 __read_funct_t wrap_read_net_sock6
1437 (struct activity *);
1438 __read_funct_t wrap_read_net_ip6
1439 (struct activity *);
1440 __read_funct_t wrap_read_net_eip6
1441 (struct activity *);
1442 __read_funct_t wrap_read_net_icmp6
1443 (struct activity *);
1444 __read_funct_t wrap_read_net_eicmp6
1445 (struct activity *);
1446 __read_funct_t wrap_read_net_udp6
1447 (struct activity *);
1448 __read_funct_t wrap_read_cpuinfo
1449 (struct activity *);
1450 __read_funct_t wrap_read_fan
1451 (struct activity *);
1452 __read_funct_t wrap_read_temp
1453 (struct activity *);
1454 __read_funct_t wrap_read_in
1455 (struct activity *);
1456 __read_funct_t wrap_read_meminfo_huge
1457 (struct activity *);
1458 __read_funct_t wrap_read_cpu_wghfreq
1459 (struct activity *);
1460 __read_funct_t wrap_read_bus_usb_dev
1461 (struct activity *);
1462 __read_funct_t wrap_read_filesystem
1463 (struct activity *);
1464 __read_funct_t wrap_read_fchost
1465 (struct activity *);
1466 __read_funct_t wrap_read_softnet
1467 (struct activity *);
1468 __read_funct_t wrap_read_psicpu
1469 (struct activity *);
1470 __read_funct_t wrap_read_psiio
1471 (struct activity *);
1472 __read_funct_t wrap_read_psimem
1473 (struct activity *);
1475 /* Other functions */
1476 int check_alt_sa_dir
1478 void enum_version_nr
1479 (struct file_magic *);
1481 (struct activity * [], unsigned int, int);
1482 int get_activity_position
1483 (struct activity * [], unsigned int, int);
1484 void handle_invalid_sa_file
1485 (int, struct file_magic *, char *, int);
1486 void print_collect_error
1488 void set_default_file
1490 int skip_extra_struct
1493 (int, const void *, int);
1497 (struct sa_item **, char *, int);
1498 void allocate_bitmaps
1499 (struct activity * []);
1500 void allocate_structures
1501 (struct activity * []);
1503 (struct activity *, int, int, int);
1504 void check_file_actlst
1505 (int *, char *, struct activity * [], uint64_t, struct file_magic *,
1506 struct file_header *, struct file_activity **, unsigned int [], int *, int *);
1507 int check_net_dev_reg
1508 (struct activity *, int, int, int);
1509 int check_net_edev_reg
1510 (struct activity *, int, int, int);
1511 double compute_ifutil
1512 (struct stats_net_dev *, double, double);
1513 void copy_structures
1514 (struct activity * [], unsigned int [], struct record_header [], int, int);
1516 (struct tm *, struct tstamp *, int);
1517 void display_sa_file_version
1518 (FILE *, struct file_magic *);
1520 (struct activity * []);
1521 void free_structures
1522 (struct activity * []);
1524 (unsigned int, unsigned int);
1525 char *get_sa_devname
1526 (unsigned int, unsigned int, unsigned long long [], unsigned int, uint64_t);
1527 void get_file_timestamp_struct
1528 (uint64_t, struct tm *, struct file_header *);
1529 char *get_fs_name_to_display
1530 (struct activity *, uint64_t, struct stats_filesystem *);
1531 unsigned long long get_global_cpu_statistics
1532 (struct activity *, int, int, uint64_t, unsigned char []);
1533 void get_global_soft_statistics
1534 (struct activity *, int, int, uint64_t, unsigned char []);
1536 (struct record_header *, struct record_header *, unsigned long long *);
1537 void init_custom_color_palette
1540 (unsigned long long, unsigned long long, int, long);
1541 void parse_sa_devices
1542 (char *, struct activity *, int, int *, int);
1544 (char * [], int *, struct activity * [], uint64_t *, int);
1546 (char * [], int *, uint64_t *, struct activity * []);
1548 (char * [], int *, uint64_t *, struct activity * []);
1550 (char * [], int *, struct activity * []);
1552 (char * [], int *, struct activity * []);
1554 (char * [], int *, struct activity * []);
1556 (char * [], int *, struct tstamp *, const char *);
1557 void print_report_hdr
1558 (uint64_t, struct tm *, struct file_header *);
1559 void print_sar_comment
1560 (int *, int, char *, char *, int, char *, struct file_header *,
1561 struct record_header *);
1562 __printf_funct_t print_sar_restart
1563 (int *, int, char *, char *, int, struct file_header *, struct record_header *);
1564 int print_special_record
1565 (struct record_header *, uint64_t, struct tstamp *, struct tstamp *,
1566 int, int, struct tm *, char *, int, struct file_magic *,
1567 struct file_header *, struct activity * [], struct report_format *, int, int);
1568 int read_file_stat_bunch
1569 (struct activity * [], int, int, int, struct file_activity *, int, int,
1570 char *, struct file_magic *, int);
1571 __nr_t read_nr_value
1572 (int, char *, struct file_magic *, int, int, int);
1574 (int, void *, struct record_header *, struct file_header *, int, int,
1575 int, size_t, uint64_t, struct report_format *);
1576 void reallocate_all_buffers
1577 (struct activity *, __nr_t);
1578 void replace_nonprintable_char
1581 (int, void *, size_t, int, int);
1582 int sa_get_record_timestamp_struct
1583 (uint64_t, struct record_header *, struct tm *);
1584 int sa_open_read_magic
1585 (int *, char *, struct file_magic *, int, int *, int);
1586 int search_list_item
1587 (struct sa_item *, char *);
1588 void select_all_activities
1589 (struct activity * []);
1590 void select_default_activity
1591 (struct activity * []);
1593 (struct activity * [], uint64_t *);
1594 void set_hdr_rectime
1595 (unsigned int, struct tm *, struct file_header *);
1596 void set_record_timestamp_string
1597 (uint64_t, struct record_header *, char *, char *, int, struct tm *);
1599 (unsigned int [], void *, int);
1600 #endif /* SOURCE_SADC undefined */