#define S_F_SVG_ONE_DAY 0x00040000
#define S_F_SVG_SHOW_IDLE 0x00080000
#define S_F_UNIT 0x00100000
+#define S_F_SVG_HEIGHT 0x00200000
#define WANT_SINCE_BOOT(m) (((m) & S_F_SINCE_BOOT) == S_F_SINCE_BOOT)
#define WANT_SA_ROTAT(m) (((m) & S_F_SA_ROTAT) == S_F_SA_ROTAT)
#define DISPLAY_ONE_DAY(m) (((m) & S_F_SVG_ONE_DAY) == S_F_SVG_ONE_DAY)
#define DISPLAY_IDLE(m) (((m) & S_F_SVG_SHOW_IDLE) == S_F_SVG_SHOW_IDLE)
#define DISPLAY_UNIT(m) (((m) & S_F_UNIT) == S_F_UNIT)
+#define SET_CANVAS_HEIGHT(m) (((m) & S_F_SVG_HEIGHT) == S_F_SVG_HEIGHT)
#define AO_F_NULL 0x00000000
#define K_ONEDAY "oneday"
#define K_SHOWIDLE "showidle"
#define K_SHOWHINTS "showhints"
+#define K_HEIGHT "height="
/* Groups of activities */
#define G_DEFAULT 0x00
unsigned int dm_major; /* Device-mapper major number */
unsigned int format = 0; /* Output format */
unsigned int f_position = 0; /* Output format position in array */
+unsigned int canvas_height = 0; /* SVG canvas height value set with option -O */
/* File header */
struct file_header file_hdr;
/* Use a decimal point to make SVG code locale independent */
setlocale(LC_NUMERIC, "C");
- /* Calculate the number of graphs to display */
- graph_nr = get_svg_graph_nr(ifd, file, file_magic,
- file_actlst, rectime, loctime);
+ if (SET_CANVAS_HEIGHT(flags)) {
+ /*
+ * Option "-O height=..." used: This is not a number
+ * of graphs but the SVG canvas height set on the command line.
+ */
+ graph_nr = canvas_height;
+ }
+ else {
+ /* Calculate the number of graphs to display */
+ graph_nr = get_svg_graph_nr(ifd, file, file_magic,
+ file_actlst, rectime, loctime);
+ }
+
if (!graph_nr)
/* No graph to display */
return;
int day_offset = 0;
int i, rc;
char dfile[MAX_FILE_LEN];
- char *t;
+ char *t, *v;
/* Get HZ */
get_HZ();
else if (!strcmp(t, K_SHOWHINTS)) {
flags |= S_F_RAW_SHOW_HINTS;
}
+ else if (!strncmp(t, K_HEIGHT, strlen(K_HEIGHT))) {
+ v = t + strlen(K_HEIGHT);
+ if (!strlen(v) || (strspn(v, DIGITS) != strlen(v))) {
+ usage(argv[0]);
+ }
+ canvas_height = atoi(v);
+ flags |= S_F_SVG_HEIGHT;
+ }
else {
usage(argv[0]);
}
* Display the header of the report (SVG format).
*
* IN:
- * @parm Specific parameter. Here: number of graphs to display.
+ * @parm Specific parameter. Here: number of graphs to display or
+ * canvas height entered on the command line.
* @action Action expected from current function.
* @dfile Name of system activity data file (unused here).
* @file_magic System activity file magic header (unused here).
if (action & F_MAIN) {
printf(" width=\"%d\" height=\"%d\""
" fill=\"black\" stroke=\"gray\" stroke-width=\"1\">\n",
- SVG_V_XSIZE, SVG_H_YSIZE + SVG_T_YSIZE * (*graph_nr));
+ SVG_V_XSIZE,
+ SET_CANVAS_HEIGHT(flags) ? *graph_nr
+ : SVG_H_YSIZE + SVG_T_YSIZE * (*graph_nr));
printf("<text x= \"0\" y=\"30\" text-anchor=\"start\" stroke=\"brown\">");
print_gal_header(localtime((const time_t *) &(file_hdr->sa_ust_time)),
file_hdr->sa_sysname, file_hdr->sa_release,