2 * sadf_misc.c: Funtions used by sadf to display special records
3 * (C) 2011-2021 by Sebastien GODARD (sysstat <at> orange.fr)
5 ***************************************************************************
6 * This program is free software; you can redistribute it and/or modify it *
7 * under the terms of the GNU General Public License as published by the *
8 * Free Software Foundation; either version 2 of the License, or (at your *
9 * option) any later version. *
11 * This program is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without the implied warranty of MERCHANTABILITY *
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
16 * You should have received a copy of the GNU General Public License along *
17 * with this program; if not, write to the Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *
19 ***************************************************************************
27 #include "pcp_def_metrics.h"
32 #define _(string) gettext(string)
34 #define _(string) (string)
38 #include <pcp/pmapi.h>
39 #include <pcp/import.h>
42 extern char *tzname[2];
44 extern uint64_t flags;
48 extern unsigned int svg_colors[][SVG_COL_PALETTE_SIZE];
51 ***************************************************************************
52 * Flush data to PCP archive.
55 * @record_hdr Record header for current sample.
56 * @flags Flags for common options.
57 ***************************************************************************
59 void pcp_write_data(struct record_header *record_hdr, unsigned int flags)
64 unsigned long long utc_sec = record_hdr->ust_time;
65 static long long delta_utc = LONG_MAX;
67 if (!PRINT_LOCAL_TIME(flags)) {
68 if (delta_utc == LONG_MAX) {
69 /* Convert a time_t value from local time to UTC */
70 if (gmtime_r((const time_t *) &(record_hdr->ust_time), &lrectime)) {
71 utc_sec = mktime(&lrectime);
72 delta_utc = utc_sec - record_hdr->ust_time;
77 * Once pmiWrite() has been called (after the first stats sample),
78 * subsequent mktime() calls will not give the same result with
79 * the same input data. So compute a time shift that will be used
80 * for the next samples.
81 * We should (really) be careful if pmiWrite() was to be used sooner
82 * than for the first stats sample (e.g. if we want to save a
83 * LINUX RESTART record heading the file).
89 /* Write data to PCP archive */
90 if ((rc = pmiWrite(utc_sec, 0)) < 0) {
91 fprintf(stderr, "PCP: pmiWrite: %s\n", pmiErrStr(rc));
98 ***************************************************************************
99 * Display restart messages (database and ppc formats).
102 * @cur_date Date string of current restart message.
103 * @cur_time Time string of current restart message.
104 * @utc True if @cur_time is expressed in UTC.
105 * @sep Character used as separator.
106 * @file_hdr System activity file standard header.
107 ***************************************************************************
109 void print_dbppc_restart(char *cur_date, char *cur_time, int utc, char sep,
110 struct file_header *file_hdr)
112 printf("%s%c-1%c", file_hdr->sa_nodename, sep, sep);
113 if (strlen(cur_date)) {
114 printf("%s ", cur_date);
116 printf("%s", cur_time);
117 if (strlen(cur_date) && utc) {
120 printf("%cLINUX-RESTART\t(%d CPU)\n",
121 sep, file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
125 ***************************************************************************
126 * Display restart messages (ppc format).
129 * @tab Number of tabulations (unused here).
130 * @action Action expected from current function.
131 * @cur_date Date string of current restart message.
132 * @cur_time Time string of current restart message.
133 * @utc True if @cur_time is expressed in UTC.
134 * @file_hdr System activity file standard header.
135 * @record_hdr Current record header (unused here).
136 ***************************************************************************
138 __printf_funct_t print_db_restart(int *tab, int action, char *cur_date,
139 char *cur_time, int utc, struct file_header *file_hdr,
140 struct record_header *record_hdr)
142 /* Actions F_BEGIN and F_END ignored */
143 if (action == F_MAIN) {
144 print_dbppc_restart(cur_date, cur_time, utc, ';', file_hdr);
149 ***************************************************************************
150 * Display restart messages (database format).
153 * @tab Number of tabulations (unused here).
154 * @action Action expected from current function.
155 * @cur_date Date string of current restart message.
156 * @cur_time Time string of current restart message.
157 * @utc True if @cur_time is expressed in UTC.
158 * @file_hdr System activity file standard header.
159 * @record_hdr Current record header (unused here).
160 ***************************************************************************
162 __printf_funct_t print_ppc_restart(int *tab, int action, char *cur_date,
163 char *cur_time, int utc, struct file_header *file_hdr,
164 struct record_header *record_hdr)
166 /* Actions F_BEGIN and F_END ignored */
167 if (action == F_MAIN) {
168 print_dbppc_restart(cur_date, cur_time, utc, '\t', file_hdr);
173 ***************************************************************************
174 * Display restart messages (XML format).
177 * @tab Number of tabulations.
178 * @action Action expected from current function.
179 * @cur_date Date string of current restart message.
180 * @cur_time Time string of current restart message.
181 * @utc True if @cur_time is expressed in UTC.
182 * @file_hdr System activity file standard header.
183 * @record_hdr Current record header (unused here).
186 * @tab Number of tabulations.
187 ***************************************************************************
189 __printf_funct_t print_xml_restart(int *tab, int action, char *cur_date,
190 char *cur_time, int utc, struct file_header *file_hdr,
191 struct record_header *record_hdr)
193 if (action & F_BEGIN) {
194 xprintf((*tab)++, "<restarts>");
196 if (action & F_MAIN) {
197 xprintf(*tab, "<boot date=\"%s\" time=\"%s\" utc=\"%d\" cpu_count=\"%d\"/>",
198 cur_date, cur_time, utc ? 1 : 0,
199 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
201 if (action & F_END) {
202 xprintf(--(*tab), "</restarts>");
207 ***************************************************************************
208 * Display restart messages (JSON format).
211 * @tab Number of tabulations.
212 * @action Action expected from current function.
213 * @cur_date Date string of current restart message.
214 * @cur_time Time string of current restart message.
215 * @utc True if @cur_time is expressed in UTC.
216 * @file_hdr System activity file standard header.
217 * @record_hdr Current record header (unused here).
220 * @tab Number of tabulations.
221 ***************************************************************************
223 __printf_funct_t print_json_restart(int *tab, int action, char *cur_date,
224 char *cur_time, int utc, struct file_header *file_hdr,
225 struct record_header *record_hdr)
227 static int sep = FALSE;
229 if (action & F_BEGIN) {
231 xprintf((*tab)++, "\"restarts\": [");
233 if (action & F_MAIN) {
237 xprintf((*tab)++, "{");
238 xprintf(*tab, "\"boot\": {\"date\": \"%s\", \"time\": \"%s\", \"utc\": %d, \"cpu_count\": %d}",
239 cur_date, cur_time, utc ? 1 : 0,
240 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
241 xprintf0(--(*tab), "}");
244 if (action & F_END) {
249 xprintf0(--(*tab), "]");
254 ***************************************************************************
255 * Display restart messages (raw format).
258 * @tab Number of tabulations (unused here).
259 * @action Action expected from current function.
260 * @cur_date Date string of current restart message.
261 * @cur_time Time string of current restart message.
262 * @utc True if @cur_time is expressed in UTC.
263 * @file_hdr System activity file standard header.
264 * @record_hdr Current record header (unused here).
265 ***************************************************************************
267 __printf_funct_t print_raw_restart(int *tab, int action, char *cur_date,
268 char *cur_time, int utc, struct file_header *file_hdr,
269 struct record_header *record_hdr)
271 /* Actions F_BEGIN and F_END ignored */
272 if (action == F_MAIN) {
273 printf("%s", cur_time);
274 if (strlen(cur_date) && utc) {
277 printf("; LINUX-RESTART (%d CPU)\n",
278 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
283 ***************************************************************************
284 * Display restart messages (PCP format).
287 * @tab Number of tabulations (unused here).
288 * @action Action expected from current function.
289 * @cur_date Date string of current restart message (unused here).
290 * @cur_time Time string of current restart message (unused here).
291 * @utc True if @cur_time is expressed in UTC (unused here).
292 * @file_hdr System activity file standard header.
293 * @record_hdr Current record header.
294 ***************************************************************************
296 __printf_funct_t print_pcp_restart(int *tab, int action, char *cur_date, char *cur_time,
297 int utc, struct file_header *file_hdr,
298 struct record_header *record_hdr)
301 static int def_metrics = FALSE;
304 if (action & F_BEGIN) {
306 pmiAddMetric("system.restart.count",
307 PM_IN_NULL, PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_DISCRETE,
308 pmiUnits(0, 0, 1, 0, 0, PM_COUNT_ONE));
310 pmiAddMetric("system.restart.ncpu",
311 PM_IN_NULL, PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_DISCRETE,
312 pmiUnits(0, 0, 1, 0, 0, PM_COUNT_ONE));
317 if (action & F_MAIN) {
318 pmiPutValue("system.restart.count", NULL, "1");
320 snprintf(buf, sizeof(buf), "%u",
321 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
322 pmiPutValue("system.restart.ncpu", NULL, buf);
324 /* Write data to PCP archive */
325 pcp_write_data(record_hdr, flags);
327 #endif /* HAVE_PCP */
331 ***************************************************************************
332 * Display comments (database and ppc formats).
335 * @cur_date Date string of current restart message.
336 * @cur_time Time string of current restart message.
337 * @utc True if @cur_time is expressed in UTC.
338 * @comment Comment to display.
339 * @sep Character used as separator.
340 * @file_hdr System activity file standard header.
341 ***************************************************************************
343 void print_dbppc_comment(char *cur_date, char *cur_time, int utc,
344 char *comment, char sep, struct file_header *file_hdr)
346 printf("%s%c-1%c", file_hdr->sa_nodename, sep, sep);
347 if (strlen(cur_date)) {
348 printf("%s ", cur_date);
350 printf("%s", cur_time);
351 if (strlen(cur_date) && utc) {
354 printf("%cCOM %s\n", sep, comment);
358 ***************************************************************************
359 * Display comments (database format).
362 * @tab Number of tabulations (unused here).
363 * @action Action expected from current function.
364 * @cur_date Date string of current restart message.
365 * @cur_time Time string of current restart message.
366 * @utc True if @cur_time is expressed in UTC.
367 * @comment Comment to display.
368 * @file_hdr System activity file standard header.
369 * @record_hdr Current record header (unused here).
370 ***************************************************************************
372 __printf_funct_t print_db_comment(int *tab, int action, char *cur_date, char *cur_time,
373 int utc, char *comment, struct file_header *file_hdr,
374 struct record_header *record_hdr)
376 /* Actions F_BEGIN and F_END ignored */
377 if (action & F_MAIN) {
378 print_dbppc_comment(cur_date, cur_time, utc, comment,
384 ***************************************************************************
385 * Display comments (ppc format).
388 * @tab Number of tabulations (unused here).
389 * @action Action expected from current function.
390 * @cur_date Date string of current restart message.
391 * @cur_time Time string of current restart message.
392 * @utc True if @cur_time is expressed in UTC.
393 * @comment Comment to display.
394 * @file_hdr System activity file standard header.
395 * @record_hdr Current record header (unused here).
396 ***************************************************************************
398 __printf_funct_t print_ppc_comment(int *tab, int action, char *cur_date, char *cur_time,
399 int utc, char *comment, struct file_header *file_hdr,
400 struct record_header *record_hdr)
402 /* Actions F_BEGIN and F_END ignored */
403 if (action & F_MAIN) {
404 print_dbppc_comment(cur_date, cur_time, utc, comment,
410 ***************************************************************************
411 * Display comments (XML format).
414 * @tab Number of tabulations.
415 * @action Action expected from current function.
416 * @cur_date Date string of current comment.
417 * @cur_time Time string of current comment.
418 * @utc True if @cur_time is expressed in UTC.
419 * @comment Comment to display.
420 * @file_hdr System activity file standard header (unused here).
421 * @record_hdr Current record header (unused here).
424 * @tab Number of tabulations.
425 ***************************************************************************
427 __printf_funct_t print_xml_comment(int *tab, int action, char *cur_date, char *cur_time,
428 int utc, char *comment, struct file_header *file_hdr,
429 struct record_header *record_hdr)
431 if (action & F_BEGIN) {
432 xprintf((*tab)++, "<comments>");
434 if (action & F_MAIN) {
435 xprintf(*tab, "<comment date=\"%s\" time=\"%s\" utc=\"%d\" com=\"%s\"/>",
436 cur_date, cur_time, utc ? 1 : 0, comment);
438 if (action & F_END) {
439 xprintf(--(*tab), "</comments>");
444 ***************************************************************************
445 * Display comments (JSON format).
448 * @tab Number of tabulations.
449 * @action Action expected from current function.
450 * @cur_date Date string of current comment.
451 * @cur_time Time string of current comment.
452 * @utc True if @cur_time is expressed in UTC.
453 * @comment Comment to display.
454 * @file_hdr System activity file standard header (unused here).
455 * @record_hdr Current record header (unused here).
458 * @tab Number of tabulations.
459 ***************************************************************************
461 __printf_funct_t print_json_comment(int *tab, int action, char *cur_date, char *cur_time,
462 int utc, char *comment, struct file_header *file_hdr,
463 struct record_header *record_hdr)
465 static int sep = FALSE;
467 if (action & F_BEGIN) {
469 xprintf((*tab)++, "\"comments\": [");
471 if (action & F_MAIN) {
475 xprintf((*tab)++, "{");
477 "\"comment\": {\"date\": \"%s\", \"time\": \"%s\", "
478 "\"utc\": %d, \"com\": \"%s\"}",
479 cur_date, cur_time, utc ? 1 : 0, comment);
480 xprintf0(--(*tab), "}");
483 if (action & F_END) {
488 xprintf0(--(*tab), "]");
493 ***************************************************************************
494 * Display comments (raw format).
497 * @tab Number of tabulations (unused here).
498 * @action Action expected from current function.
499 * @cur_date Date string of current restart message.
500 * @cur_time Time string of current restart message.
501 * @utc True if @cur_time is expressed in UTC.
502 * @comment Comment to display.
503 * @file_hdr System activity file standard header (unused here).
504 * @record_hdr Current record header (unused here).
505 ***************************************************************************
507 __printf_funct_t print_raw_comment(int *tab, int action, char *cur_date, char *cur_time,
508 int utc, char *comment, struct file_header *file_hdr,
509 struct record_header *record_hdr)
511 /* Actions F_BEGIN and F_END ignored */
512 if (action & F_MAIN) {
513 printf("%s", cur_time);
514 if (strlen(cur_date) && utc) {
517 printf("; COM %s\n", comment);
522 ***************************************************************************
523 * Display comments (PCP format).
526 * @tab Number of tabulations (unused here).
527 * @action Action expected from current function.
528 * @cur_date Date string of current restart message (unused here).
529 * @cur_time Time string of current restart message (unused here).
530 * @utc True if @cur_time is expressed in UTC (unused here).
531 * @comment Comment to display.
532 * @file_hdr System activity file standard header (unused here).
533 * @record_hdr Current record header.
534 ***************************************************************************
536 __printf_funct_t print_pcp_comment(int *tab, int action, char *cur_date, char *cur_time,
537 int utc, char *comment, struct file_header *file_hdr,
538 struct record_header *record_hdr)
541 static int def_metrics = FALSE;
543 if (action & F_BEGIN) {
545 pmiAddMetric("system.comment.value",
546 PM_IN_NULL, PM_TYPE_STRING, PM_INDOM_NULL, PM_SEM_DISCRETE,
547 pmiUnits(0, 0, 0, 0, 0, 0));
552 if (action & F_MAIN) {
553 pmiPutValue("system.comment.value", NULL, comment);
555 /* Write data to PCP archive */
556 pcp_write_data(record_hdr, flags);
558 #endif /* HAVE_PCP */
562 ***************************************************************************
563 * Display the "statistics" part of the report (XML format).
566 * @tab Number of tabulations.
567 * @action Action expected from current function.
568 * @act Array of activities (unused here).
569 * @id_seq Activity sequence (unused here).
572 * @tab Number of tabulations.
573 ***************************************************************************
575 __printf_funct_t print_xml_statistics(int *tab, int action, struct activity *act[],
576 unsigned int id_seq[])
578 if (action & F_BEGIN) {
579 xprintf((*tab)++, "<statistics>");
581 if (action & F_END) {
582 xprintf(--(*tab), "</statistics>");
587 ***************************************************************************
588 * Display the "statistics" part of the report (JSON format).
591 * @tab Number of tabulations.
592 * @action Action expected from current function.
593 * @act Array of activities (unused here).
594 * @id_seq Activity sequence (unused here).
597 * @tab Number of tabulations.
598 ***************************************************************************
600 __printf_funct_t print_json_statistics(int *tab, int action, struct activity *act[],
601 unsigned int id_seq[])
603 static int sep = FALSE;
605 if (action & F_BEGIN) {
607 xprintf((*tab)++, "\"statistics\": [");
609 if (action & F_MAIN) {
611 xprintf(--(*tab), "},");
613 xprintf((*tab)++, "{");
616 if (action & F_END) {
618 xprintf(--(*tab), "}");
621 xprintf0(--(*tab), "]");
626 ***************************************************************************
627 * Display the "statistics" part of the report (PCP format).
630 * @tab Number of tabulations (unused here).
631 * @action Action expected from current function.
632 * @act Array of activities.
633 * @id_seq Activity sequence.
634 ***************************************************************************
636 __printf_funct_t print_pcp_statistics(int *tab, int action, struct activity *act[],
637 unsigned int id_seq[])
642 if (action & F_BEGIN) {
643 for (i = 0; i < NR_ACT; i++) {
645 continue; /* Activity not in file */
647 p = get_activity_position(act, id_seq[i], EXIT_IF_NOT_FOUND);
648 if (!IS_SELECTED(act[p]->options))
649 continue; /* Activity not selected */
651 switch (act[p]->id) {
656 pcp_def_cpu_metrics(act[p]);
660 pcp_def_pcsw_metrics();
664 pcp_def_irq_metrics(act[p]);
668 pcp_def_swap_metrics();
672 pcp_def_paging_metrics();
676 pcp_def_io_metrics();
680 pcp_def_memory_metrics(act[p]);
684 pcp_def_ktables_metrics();
688 pcp_def_queue_metrics();
692 pcp_def_serial_metrics(act[p]);
696 pcp_def_disk_metrics(act[p]);
701 pcp_def_net_dev_metrics(act[p]);
705 pcp_def_net_nfs_metrics();
709 pcp_def_net_nfsd_metrics();
713 pcp_def_net_sock_metrics();
717 pcp_def_net_ip_metrics();
721 pcp_def_net_eip_metrics();
725 pcp_def_net_icmp_metrics();
729 pcp_def_net_eicmp_metrics();
733 pcp_def_net_tcp_metrics();
737 pcp_def_net_etcp_metrics();
741 pcp_def_net_udp_metrics();
745 pcp_def_net_sock6_metrics();
749 pcp_def_net_ip6_metrics();
753 pcp_def_net_eip6_metrics();
757 pcp_def_net_icmp6_metrics();
761 pcp_def_net_eicmp6_metrics();
765 pcp_def_net_udp6_metrics();
769 pcp_def_huge_metrics();
773 pcp_def_pwr_fan_metrics(act[p]);
777 pcp_def_pwr_temp_metrics(act[p]);
781 pcp_def_pwr_in_metrics(act[p]);
785 pcp_def_pwr_usb_metrics(act[p]);
789 pcp_def_filesystem_metrics(act[p]);
793 pcp_def_fchost_metrics(act[p]);
799 pcp_def_psi_metrics(act[p]);
804 #endif /* HAVE_PCP */
808 ***************************************************************************
809 * Display the "timestamp" part of the report (db and ppc format).
812 * @fmt Output format (F_DB_OUTPUT or F_PPC_OUTPUT).
813 * @file_hdr System activity file standard header.
814 * @cur_date Date string of current record.
815 * @cur_time Time string of current record.
816 * @utc True if @cur_time is expressed in UTC.
817 * @itv Interval of time with preceding record.
820 * Pointer on the "timestamp" string.
821 ***************************************************************************
823 char *print_dbppc_timestamp(int fmt, struct file_header *file_hdr, char *cur_date,
824 char *cur_time, int utc, unsigned long long itv)
826 int isdb = (fmt == F_DB_OUTPUT);
827 static char pre[512];
828 char temp1[128], temp2[256];
830 /* This substring appears on every output line, preformat it here */
831 snprintf(temp1, sizeof(temp1), "%s%s%lld%s",
832 file_hdr->sa_nodename, seps[isdb], itv, seps[isdb]);
833 if (strlen(cur_date)) {
834 snprintf(temp2, sizeof(temp2), "%s%s ", temp1, cur_date);
837 strcpy(temp2, temp1);
839 snprintf(pre, sizeof(pre), "%s%s%s", temp2, cur_time,
840 strlen(cur_date) && utc ? " UTC" : "");
841 pre[sizeof(pre) - 1] = '\0';
843 if (DISPLAY_HORIZONTALLY(flags)) {
851 ***************************************************************************
852 * Display the "timestamp" part of the report (ppc format).
855 * @parm Pointer on specific parameters (unused here).
856 * @action Action expected from current function.
857 * @cur_date Date string of current record.
858 * @cur_time Time string of current record.
859 * @itv Interval of time with preceding record.
860 * @record_hdr Record header for current sample (unused here).
861 * @file_hdr System activity file standard header.
862 * @flags Flags for common options.
865 * Pointer on the "timestamp" string.
866 ***************************************************************************
868 __tm_funct_t print_ppc_timestamp(void *parm, int action, char *cur_date,
869 char *cur_time, unsigned long long itv,
870 struct record_header *record_hdr,
871 struct file_header *file_hdr, unsigned int flags)
873 int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags);
875 if (action & F_BEGIN) {
876 return print_dbppc_timestamp(F_PPC_OUTPUT, file_hdr, cur_date, cur_time, utc, itv);
883 ***************************************************************************
884 * Display the "timestamp" part of the report (db format).
887 * @parm Pointer on specific parameters (unused here).
888 * @action Action expected from current function.
889 * @cur_date Date string of current record.
890 * @cur_time Time string of current record.
891 * @itv Interval of time with preceding record.
892 * @record_hdr Record header for current sample (unused here).
893 * @file_hdr System activity file standard header.
894 * @flags Flags for common options.
897 * Pointer on the "timestamp" string.
898 ***************************************************************************
900 __tm_funct_t print_db_timestamp(void *parm, int action, char *cur_date,
901 char *cur_time, unsigned long long itv,
902 struct record_header *record_hdr,
903 struct file_header *file_hdr, unsigned int flags)
905 int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags);
907 if (action & F_BEGIN) {
908 return print_dbppc_timestamp(F_DB_OUTPUT, file_hdr, cur_date, cur_time, utc, itv);
910 if (action & F_END) {
911 if (DISPLAY_HORIZONTALLY(flags)) {
920 ***************************************************************************
921 * Display the "timestamp" part of the report (XML format).
924 * @parm Specific parameter. Here: number of tabulations.
925 * @action Action expected from current function.
926 * @cur_date Date string of current comment.
927 * @cur_time Time string of current comment.
928 * @itv Interval of time with preceding record.
929 * @record_hdr Record header for current sample (unused here).
930 * @file_hdr System activity file standard header (unused here).
931 * @flags Flags for common options.
932 ***************************************************************************
934 __tm_funct_t print_xml_timestamp(void *parm, int action, char *cur_date,
935 char *cur_time, unsigned long long itv,
936 struct record_header *record_hdr,
937 struct file_header *file_hdr, unsigned int flags)
939 int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags);
940 int *tab = (int *) parm;
942 if (action & F_BEGIN) {
943 xprintf((*tab)++, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\">",
944 cur_date, cur_time, utc ? 1 : 0, itv);
946 if (action & F_END) {
947 xprintf(--(*tab), "</timestamp>");
954 ***************************************************************************
955 * Display the "timestamp" part of the report (JSON format).
958 * @parm Specific parameter. Here: number of tabulations.
959 * @action Action expected from current function.
960 * @cur_date Date string of current comment.
961 * @cur_time Time string of current comment.
962 * @itv Interval of time with preceding record.
963 * @record_hdr Record header for current sample (unused here).
964 * @file_hdr System activity file standard header (unused here).
965 * @flags Flags for common options.
966 ***************************************************************************
968 __tm_funct_t print_json_timestamp(void *parm, int action, char *cur_date,
969 char *cur_time, unsigned long long itv,
970 struct record_header *record_hdr,
971 struct file_header *file_hdr, unsigned int flags)
973 int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags);
974 int *tab = (int *) parm;
976 if (action & F_BEGIN) {
978 "\"timestamp\": {\"date\": \"%s\", \"time\": \"%s\", "
979 "\"utc\": %d, \"interval\": %llu}",
980 cur_date, cur_time, utc ? 1 : 0, itv);
982 if (action & F_MAIN) {
985 if (action & F_END) {
993 ***************************************************************************
994 * Display the "timestamp" part of the report (raw format).
997 * @parm Pointer on specific parameters (unused here).
998 * @action Action expected from current function.
999 * @cur_date Date string of current record.
1000 * @cur_time Time string of current record.
1001 * @itv Interval of time with preceding record (unused here).
1002 * @record_hdr Record header for current sample (unused here).
1003 * @file_hdr System activity file standard header (unused here).
1004 * @flags Flags for common options.
1007 * Pointer on the "timestamp" string.
1008 ***************************************************************************
1010 __tm_funct_t print_raw_timestamp(void *parm, int action, char *cur_date,
1011 char *cur_time, unsigned long long itv,
1012 struct record_header *record_hdr,
1013 struct file_header *file_hdr, unsigned int flags)
1015 int utc = !PRINT_LOCAL_TIME(flags) && !PRINT_TRUE_TIME(flags);
1016 static char pre[80];
1018 if (action & F_BEGIN) {
1019 snprintf(pre, 80, "%s%s", cur_time, strlen(cur_date) && utc ? " UTC" : "");
1028 ***************************************************************************
1029 * Display the "timestamp" part of the report (PCP format).
1032 * @parm Pointer on specific parameters (unused here).
1033 * @action Action expected from current function.
1034 * @cur_date Date string of current record (unused here).
1035 * @cur_time Time string of current record (unused here).
1036 * @itv Interval of time with preceding record (unused here).
1037 * @record_hdr Record header for current sample.
1038 * @file_hdr System activity file standard header (unused here).
1039 * @flags Flags for common options.
1042 * Pointer on the "timestamp" string.
1043 ***************************************************************************
1045 __tm_funct_t print_pcp_timestamp(void *parm, int action, char *cur_date,
1046 char *cur_time, unsigned long long itv,
1047 struct record_header *record_hdr,
1048 struct file_header *file_hdr, unsigned int flags)
1050 if (action & F_END) {
1051 pcp_write_data(record_hdr, flags);
1058 ***************************************************************************
1059 * Display the header of the report (XML format).
1062 * @parm Specific parameter. Here: number of tabulations.
1063 * @action Action expected from current function.
1064 * @dfile Unused here (PCP archive file).
1065 * @file_magic System activity file magic header.
1066 * @file_hdr System activity file standard header.
1067 * @act Array of activities (unused here).
1068 * @id_seq Activity sequence (unused here).
1069 * @file_actlst List of (known or unknown) activities in file (unused here).
1072 * @parm Number of tabulations.
1073 ***************************************************************************
1075 __printf_funct_t print_xml_header(void *parm, int action, char *dfile,
1076 struct file_magic *file_magic,
1077 struct file_header *file_hdr,
1078 struct activity *act[], unsigned int id_seq[],
1079 struct file_activity *file_actlst)
1081 struct tm rectime, loc_t;
1082 char cur_time[TIMESTAMP_LEN];
1083 int *tab = (int *) parm;
1085 if (action & F_BEGIN) {
1086 printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
1087 printf("<!DOCTYPE sysstat PUBLIC \"DTD v%s sysstat //EN\"\n",
1089 printf("\"http://pagesperso-orange.fr/sebastien.godard/sysstat-%s.dtd\">\n",
1092 xprintf(*tab, "<sysstat\n"
1093 "xmlns=\"http://pagesperso-orange.fr/sebastien.godard/sysstat\"\n"
1094 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
1095 "xsi:schemaLocation=\"http://pagesperso-orange.fr/sebastien.godard sysstat.xsd\">");
1097 xprintf(++(*tab), "<sysdata-version>%s</sysdata-version>",
1100 xprintf(*tab, "<host nodename=\"%s\">", file_hdr->sa_nodename);
1101 xprintf(++(*tab), "<sysname>%s</sysname>", file_hdr->sa_sysname);
1102 xprintf(*tab, "<release>%s</release>", file_hdr->sa_release);
1104 xprintf(*tab, "<machine>%s</machine>", file_hdr->sa_machine);
1105 xprintf(*tab, "<number-of-cpus>%d</number-of-cpus>",
1106 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
1108 /* Fill file timestmap structure (rectime) */
1109 get_file_timestamp_struct(flags, &rectime, file_hdr);
1110 strftime(cur_time, sizeof(cur_time), "%Y-%m-%d", &rectime);
1111 xprintf(*tab, "<file-date>%s</file-date>", cur_time);
1113 if (gmtime_r((const time_t *) &file_hdr->sa_ust_time, &loc_t) != NULL) {
1114 strftime(cur_time, sizeof(cur_time), "%T", &loc_t);
1115 xprintf(*tab, "<file-utc-time>%s</file-utc-time>", cur_time);
1118 xprintf(*tab, "<timezone>%s</timezone>", file_hdr->sa_tzname);
1120 if (action & F_END) {
1121 xprintf(--(*tab), "</host>");
1122 xprintf(--(*tab), "</sysstat>");
1127 ***************************************************************************
1128 * Display the header of the report (JSON format).
1131 * @parm Specific parameter. Here: number of tabulations.
1132 * @action Action expected from current function.
1133 * @dfile Unused here (PCP archive file).
1134 * @file_magic System activity file magic header.
1135 * @file_hdr System activity file standard header.
1136 * @act Array of activities (unused here).
1137 * @id_seq Activity sequence (unused here).
1138 * @file_actlst List of (known or unknown) activities in file (unused here).
1141 * @parm Number of tabulations.
1142 ***************************************************************************
1144 __printf_funct_t print_json_header(void *parm, int action, char *dfile,
1145 struct file_magic *file_magic,
1146 struct file_header *file_hdr,
1147 struct activity *act[], unsigned int id_seq[],
1148 struct file_activity *file_actlst)
1150 struct tm rectime, loc_t;
1151 char cur_time[TIMESTAMP_LEN];
1152 int *tab = (int *) parm;
1154 if (action & F_BEGIN) {
1155 xprintf(*tab, "{\"sysstat\": {");
1157 xprintf(++(*tab), "\"hosts\": [");
1158 xprintf(++(*tab), "{");
1159 xprintf(++(*tab), "\"nodename\": \"%s\",", file_hdr->sa_nodename);
1160 xprintf(*tab, "\"sysname\": \"%s\",", file_hdr->sa_sysname);
1161 xprintf(*tab, "\"release\": \"%s\",", file_hdr->sa_release);
1163 xprintf(*tab, "\"machine\": \"%s\",", file_hdr->sa_machine);
1164 xprintf(*tab, "\"number-of-cpus\": %d,",
1165 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
1167 /* Fill file timestmap structure (rectime) */
1168 get_file_timestamp_struct(flags, &rectime, file_hdr);
1169 strftime(cur_time, sizeof(cur_time), "%Y-%m-%d", &rectime);
1170 xprintf(*tab, "\"file-date\": \"%s\",", cur_time);
1172 if (gmtime_r((const time_t *) &file_hdr->sa_ust_time, &loc_t) != NULL) {
1173 strftime(cur_time, sizeof(cur_time), "%T", &loc_t);
1174 xprintf(*tab, "\"file-utc-time\": \"%s\",", cur_time);
1177 xprintf0(*tab, "\"timezone\": \"%s\"", file_hdr->sa_tzname);
1179 if (action & F_END) {
1181 xprintf(--(*tab), "}");
1182 xprintf(--(*tab), "]");
1183 xprintf(--(*tab), "}}");
1188 ***************************************************************************
1189 * Display data file header.
1192 * @parm Specific parameter (unused here).
1193 * @action Action expected from current function.
1194 * @dfile Name of system activity data file (unused here).
1195 * @file_magic System activity file magic header.
1196 * @file_hdr System activity file standard header.
1197 * @act Array of activities.
1198 * @id_seq Activity sequence.
1199 * @file_actlst List of (known or unknown) activities in file.
1200 ***************************************************************************
1202 __printf_funct_t print_hdr_header(void *parm, int action, char *dfile,
1203 struct file_magic *file_magic,
1204 struct file_header *file_hdr,
1205 struct activity *act[], unsigned int id_seq[],
1206 struct file_activity *file_actlst)
1209 struct tm rectime, loc_t;
1210 struct file_activity *fal;
1211 char cur_time[TIMESTAMP_LEN];
1213 /* Actions F_MAIN and F_END ignored */
1214 if (action & F_BEGIN) {
1215 printf(_("System activity data file: %s (%#x)\n"),
1216 dfile, file_magic->format_magic);
1218 display_sa_file_version(stdout, file_magic);
1220 if (file_magic->format_magic != FORMAT_MAGIC) {
1224 printf(_("Genuine sa datafile: %s (%x)\n"),
1225 file_magic->upgraded ? _("no") : _("yes"),
1226 file_magic->upgraded);
1228 printf(_("Host: "));
1229 print_gal_header(localtime_r((const time_t *) &(file_hdr->sa_ust_time), &rectime),
1230 file_hdr->sa_sysname, file_hdr->sa_release,
1231 file_hdr->sa_nodename, file_hdr->sa_machine,
1232 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1,
1235 /* Fill file timestamp structure (rectime) */
1236 get_file_timestamp_struct(flags, &rectime, file_hdr);
1237 strftime(cur_time, sizeof(cur_time), "%Y-%m-%d", &rectime);
1238 printf(_("File date: %s\n"), cur_time);
1240 if (gmtime_r((const time_t *) &file_hdr->sa_ust_time, &loc_t) != NULL) {
1241 printf(_("File time: "));
1242 strftime(cur_time, sizeof(cur_time), "%T", &loc_t);
1243 printf("%s UTC (%lld)\n", cur_time, file_hdr->sa_ust_time);
1246 printf(_("Timezone: %s\n"), file_hdr->sa_tzname);
1248 /* File composition: file_header, file_activity, record_header */
1249 printf(_("File composition: (%d,%d,%d),(%d,%d,%d),(%d,%d,%d)\n"),
1250 file_magic->hdr_types_nr[0], file_magic->hdr_types_nr[1], file_magic->hdr_types_nr[2],
1251 file_hdr->act_types_nr[0], file_hdr->act_types_nr[1], file_hdr->act_types_nr[2],
1252 file_hdr->rec_types_nr[0], file_hdr->rec_types_nr[1], file_hdr->rec_types_nr[2]);
1254 printf(_("Size of a long int: %d\n"), file_hdr->sa_sizeof_long);
1255 printf("HZ = %lu\n", file_hdr->sa_hz);
1256 printf(_("Number of activities in file: %u\n"),
1257 file_hdr->sa_act_nr);
1258 printf(_("Extra structures available: %c\n"),
1259 file_hdr->extra_next ? 'Y' : 'N');
1261 printf(_("List of activities:\n"));
1263 for (i = 0; i < file_hdr->sa_act_nr; i++, fal++) {
1265 p = get_activity_position(act, fal->id, RESUME_IF_NOT_FOUND);
1267 printf("%02d: [%02x] ", fal->id, fal->magic);
1269 printf("%-20s", act[p]->name);
1272 printf("%-20s", _("Unknown activity"));
1274 printf(" %c:%4d", fal->has_nr ? 'Y' : 'N', fal->nr);
1276 printf("x%d", fal->nr2);
1278 printf("\t(%d,%d,%d)", fal->types_nr[0], fal->types_nr[1], fal->types_nr[2]);
1279 if ((p >= 0) && (act[p]->magic == ACTIVITY_MAGIC_UNKNOWN)) {
1280 printf(_(" \t[Unknown format]"));
1288 ***************************************************************************
1289 * Display the header of the report (SVG format).
1292 * @parm Specific parameters. Here: number of rows of views to display
1293 * or canvas height entered on the command line (@graph_nr), and
1294 * max number of views on a single row (@views_per_row).
1295 * @action Action expected from current function.
1296 * @dfile Name of system activity data file (unused here).
1297 * @file_magic System activity file magic header (unused here).
1298 * @file_hdr System activity file standard header.
1299 * @act Array of activities (unused here).
1300 * @id_seq Activity sequence (unused here).
1301 * @file_actlst List of (known or unknown) activities in file (unused here).
1302 ***************************************************************************
1304 __printf_funct_t print_svg_header(void *parm, int action, char *dfile,
1305 struct file_magic *file_magic,
1306 struct file_header *file_hdr,
1307 struct activity *act[], unsigned int id_seq[],
1308 struct file_activity *file_actlst)
1310 struct svg_hdr_parm *hdr_parm = (struct svg_hdr_parm *) parm;
1312 unsigned int height = 0, ht = 0;
1315 if (action & F_BEGIN) {
1316 printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
1317 printf("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" ");
1318 printf("\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
1319 printf("<svg xmlns=\"http://www.w3.org/2000/svg\"");
1320 if (DISPLAY_TOC(flags)) {
1321 printf(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"");
1323 if (action & F_END) {
1328 if (action & F_MAIN) {
1329 if (SET_CANVAS_HEIGHT(flags)) {
1331 * Option "-O height=..." used: @graph_nr is
1332 * the SVG canvas height set on the command line.
1334 height = hdr_parm->graph_nr;
1337 height = SVG_H_YSIZE +
1338 SVG_C_YSIZE * (DISPLAY_TOC(flags) ? hdr_parm->nr_act_dispd : 0) +
1339 SVG_T_YSIZE * hdr_parm->graph_nr;
1342 /* Min canvas height is 100 (at least to display "No data") */
1345 printf(" width=\"%d\" height=\"%d\""
1346 " fill=\"black\" stroke=\"#%06x\" stroke-width=\"1\">\n",
1347 SVG_T_XSIZE * (hdr_parm->views_per_row), height,
1348 svg_colors[palette][SVG_COL_DEFAULT_IDX]);
1349 printf("<text x=\"0\" y=\"30\" text-anchor=\"start\" stroke=\"#%06x\">",
1350 svg_colors[palette][SVG_COL_HEADER_IDX]);
1351 print_gal_header(localtime_r((const time_t *) &(file_hdr->sa_ust_time), &rectime),
1352 file_hdr->sa_sysname, file_hdr->sa_release,
1353 file_hdr->sa_nodename, file_hdr->sa_machine,
1354 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1,
1356 printf("</text>\n");
1357 if (DISPLAY_TOC(flags)) {
1358 for (i = 0; i < NR_ACT; i++) {
1360 continue; /* Activity not in file */
1362 p = get_activity_position(act, id_seq[i], EXIT_IF_NOT_FOUND);
1363 if (!IS_SELECTED(act[p]->options) || !act[p]->g_nr)
1364 continue; /* Activity not selected or no graph available */
1366 printf("<a xlink:href=\"#g%d-0\" xlink:title=\"%s\">\n",
1367 act[p]->id, act[p]->name);
1368 printf("<text x=\"10\" y=\"%d\">%s</text></a>\n",
1369 SVG_H_YSIZE + ht, act[p]->desc);
1375 if (action & F_END) {
1376 if (!(action & F_BEGIN)) {
1377 if (!hdr_parm->graph_nr) {
1378 /* No views displayed */
1379 printf("<text x= \"0\" y=\"%d\" text-anchor=\"start\" stroke=\"#%06x\">",
1381 SVG_C_YSIZE * (DISPLAY_TOC(flags) ? hdr_parm->nr_act_dispd : 0),
1382 svg_colors[palette][SVG_COL_ERROR_IDX]);
1383 printf("No data!</text>\n");
1385 /* Give actual SVG height */
1386 printf("<!-- Actual canvas height: %d -->\n",
1388 SVG_C_YSIZE * (DISPLAY_TOC(flags) ? hdr_parm->nr_act_dispd : 0) +
1389 SVG_T_YSIZE * hdr_parm->graph_nr);
1396 ***************************************************************************
1397 * PCP header function.
1400 * @parm Specific parameter (unused here).
1401 * @action Action expected from current function.
1402 * @dfile Name of PCP archive file.
1403 * @file_magic System activity file magic header (unused here).
1404 * @file_hdr System activity file standard header (unused here).
1405 * @act Array of activities (unused here).
1406 * @id_seq Activity sequence (unused here).
1407 * @file_actlst List of (known or unknown) activities in file (unused here).
1408 ***************************************************************************
1410 __printf_funct_t print_pcp_header(void *parm, int action, char *dfile,
1411 struct file_magic *file_magic,
1412 struct file_header *file_hdr,
1413 struct activity *act[], unsigned int id_seq[],
1414 struct file_activity *file_actlst)
1419 unsigned long long utc_sec = file_hdr->sa_ust_time;
1421 if (action & F_BEGIN) {
1422 /* Create new PCP context */
1423 pmiStart(dfile, FALSE);
1425 if (PRINT_LOCAL_TIME(flags)) {
1426 pmiSetTimezone(file_hdr->sa_tzname);
1429 pmiSetTimezone("UTC");
1433 pmiSetHostname(file_hdr->sa_nodename);
1435 /* Save number of CPU in PCP archive */
1436 pmiAddMetric("hinv.ncpu",
1437 PM_IN_NULL, PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_DISCRETE,
1438 pmiUnits(0, 0, 1, 0, 0, PM_COUNT_ONE));
1439 snprintf(buf, sizeof(buf), "%u",
1440 file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1);
1441 pmiPutValue("hinv.ncpu", NULL, buf);
1444 if (action & F_END) {
1445 if (action & F_BEGIN) {
1446 /* Only the header data will be written to PCP archive */
1447 if (!PRINT_LOCAL_TIME(flags)) {
1448 /* Convert a time_t value from local time to UTC */
1449 if (gmtime_r((const time_t *) &(file_hdr->sa_ust_time), &lrectime)) {
1450 utc_sec = mktime(&lrectime);
1453 pmiWrite(utc_sec, 0);
1461 ***************************************************************************
1462 * Count the number of new network interfaces in current sample. If a new
1463 * interface is found then add it to the linked list starting at
1467 * @a Activity structure with statistics.
1468 * @curr Index in array for current sample statistics.
1471 * Number of new interfaces identified in current sample that were not
1472 * previously in the list.
1473 ***************************************************************************
1475 __nr_t count_new_net_dev(struct activity *a, int curr)
1478 struct stats_net_dev *sndc;
1480 for (i = 0; i < a->nr[curr]; i++) {
1481 sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
1483 nr += add_list_item(&(a->item_list), sndc->interface, MAX_IFACE_LEN);
1490 ***************************************************************************
1491 * Count the number of new network interfaces in current sample. If a new
1492 * interface is found then add it to the linked list starting at
1496 * @a Activity structure with statistics.
1497 * @curr Index in array for current sample statistics.
1500 * Number of new interfaces identified in current sample that were not
1501 * previously in the list.
1502 ***************************************************************************
1504 __nr_t count_new_net_edev(struct activity *a, int curr)
1507 struct stats_net_edev *snedc;
1509 for (i = 0; i < a->nr[curr]; i++) {
1510 snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
1512 nr += add_list_item(&(a->item_list), snedc->interface, MAX_IFACE_LEN);
1519 ***************************************************************************
1520 * Count the number of new filesystems in current sample. If a new
1521 * filesystem is found then add it to the linked list starting at
1525 * @a Activity structure with statistics.
1526 * @curr Index in array for current sample statistics.
1529 * Number of new filesystems identified in current sample that were not
1530 * previously in the list.
1531 ***************************************************************************
1533 __nr_t count_new_filesystem(struct activity *a, int curr)
1536 struct stats_filesystem *sfc;
1538 for (i = 0; i < a->nr[curr]; i++) {
1539 sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
1541 nr += add_list_item(&(a->item_list),
1542 get_fs_name_to_display(a, flags, sfc),
1550 ***************************************************************************
1551 * Count the number of new fchosts in current sample. If a new
1552 * fchost is found then add it to the linked list starting at
1556 * @a Activity structure with statistics.
1557 * @curr Index in array for current sample statistics.
1560 * Number of new fchosts identified in current sample that were not
1561 * previously in the list.
1562 ***************************************************************************
1564 __nr_t count_new_fchost(struct activity *a, int curr)
1567 struct stats_fchost *sfcc;
1569 for (i = 0; i < a->nr[curr]; i++) {
1570 sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
1572 nr += add_list_item(&(a->item_list), sfcc->fchost_name, MAX_FCH_LEN);
1579 ***************************************************************************
1580 * Count the number of new block devices in current sample. If a new
1581 * block device is found then add it to the linked list starting at
1585 * @a Activity structure with statistics.
1586 * @curr Index in array for current sample statistics.
1589 * Number of new block devices identified in current sample that were not
1590 * previously in the list.
1591 ***************************************************************************
1593 __nr_t count_new_disk(struct activity *a, int curr)
1596 struct stats_disk *sdc;
1598 for (i = 0; i < a->nr[curr]; i++) {
1599 sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
1601 nr += add_list_item(&(a->item_list),
1602 get_device_name(sdc->major, sdc->minor, sdc->wwn, sdc->part_nr,
1603 DISPLAY_PRETTY(flags), DISPLAY_PERSIST_NAME_S(flags),
1604 USE_STABLE_ID(flags), NULL),
1612 ***************************************************************************
1613 * Init custom color palette used to draw graphs (sadf -g).
1614 ***************************************************************************
1616 void init_custom_color_palette()
1622 /* Read S_COLORS_PALETTE environment variable */
1623 if ((e = __getenv(ENV_COLORS_PALETTE)) == NULL)
1624 /* Environment variable not set */
1627 for (p = strtok(e, ":"); p; p =strtok(NULL, ":")) {
1630 if ((len > 8) || (len < 3) || (*(p + 1) != '=') ||
1631 (strspn(p + 2, "0123456789ABCDEFabcdef") != (len - 2)))
1632 /* Ignore malformed codes */
1635 sscanf(p + 2, "%x", &val);
1637 if ((*p >= '0') && (*p <= '9')) {
1638 svg_colors[SVG_CUSTOM_COL_PALETTE][*p & 0xf] = val;
1641 else if (((*p >= 'A') && (*p <= 'F')) ||
1642 ((*p >= 'a') && (*p <= 'f'))) {
1643 svg_colors[SVG_CUSTOM_COL_PALETTE][9 + (*p & 0xf)] = val;
1649 svg_colors[SVG_CUSTOM_COL_PALETTE][SVG_COL_GRID_IDX] = val;
1652 svg_colors[SVG_CUSTOM_COL_PALETTE][SVG_COL_HEADER_IDX] = val;
1655 svg_colors[SVG_CUSTOM_COL_PALETTE][SVG_COL_INFO_IDX] = val;
1658 svg_colors[SVG_CUSTOM_COL_PALETTE][SVG_COL_BCKGRD_IDX] = val;
1661 svg_colors[SVG_CUSTOM_COL_PALETTE][SVG_COL_DEFAULT_IDX] = val;
1664 svg_colors[SVG_CUSTOM_COL_PALETTE][SVG_COL_TITLE_IDX] = val;
1667 svg_colors[SVG_CUSTOM_COL_PALETTE][SVG_COL_ERROR_IDX] = val;
1670 svg_colors[SVG_CUSTOM_COL_PALETTE][SVG_COL_AXIS_IDX] = val;