[lttng-dev] [LTTNG-TOOLS PATCH] On-disk multiple tracefiles circular buffer

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Fri Mar 8 09:34:31 EST 2013


> @@ -78,6 +80,8 @@ static struct poptOption long_options[] = {
>  	{"read-timer",     0,   POPT_ARG_INT, 0, OPT_READ_TIMER, 0, 0},
>  	{"list-options",   0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
>  	{"output",         0,   POPT_ARG_STRING, &opt_output, 0, 0, 0},
> +	{"tracefile_size", 'C',   POPT_ARG_INT, 0, OPT_TRACEFILE_SIZE, 0, 0},
> +	{"tracefile_count", 'W',   POPT_ARG_INT, 0, OPT_TRACEFILE_COUNT, 0, 0},
>  	{0, 0, 0, 0, 0, 0, 0}
>  };
>
> @@ -117,6 +121,8 @@ static void usage(FILE *ofp)
>  		DEFAULT_CHANNEL_READ_TIMER);
>  	fprintf(ofp, "      --output TYPE        Channel output type (Values: %s, %s)\n",
>  			output_mmap, output_splice);
> +	fprintf(ofp, "  -C, --tracefile-size NUM     Maximum size of tracefiles (in bytes)\n");
> +	fprintf(ofp, "  -W, --tracefile-count NUM    Number of tracefiles to keep\n");
>  	fprintf(ofp, "\n");
>  }

   You've got the command options parsed as "tracefile_size" but documented as "tracefile-size" (likewise for _count/-count).  The latter is preferable for consistency with the rest of the user interface.
 
> @@ -175,6 +187,15 @@ static int enable_channel(char *session_name)
>
>	set_default_attr(&dom);
>
> +	if ((chan.attr.tracefile_size > 0) &&
> +			(chan.attr.tracefile_size < chan.attr.subbuf_size)) {
> +		ERR("Tracefile_size must be superior or equal to subbuf_size "
> +				"(%" PRIu64 " < %" PRIu64 ")",
> +				chan.attr.tracefile_size, chan.attr.subbuf_size);
> +		ret = CMD_ERROR;
> +		goto error;
> +	}

   That should be ERR("The tracefile-size must be superior or equal to the subbuf-size ".

   I hope the man pages will make clear how these two new command options work, as the initial presentation of tracefile-size as the "Maximum size of tracefiles (in bytes)" and tracefile-count as the "Number of tracefiles to keep" can be understood quite wrongly.  It can be misconstrued to mean each trace file is limited in size (so only the first SIZE bytes are captured, the rest is thrown away), or that the limitation applies to the *set* of trace files (maximum total size of trace files, the sum being over all CPU IDs for that channel).  The chunking mechanism should also explain its circularity, as a user could initially expect the trace file chunk numbering to be open-ended, the excess files (assuming tracefile-count is set) being deleted from the low-number end (e.g. a tracefile-count of two could be expected to yield, once the trace is concluded, the files "channel0_0_23" and "channel0_0_24").

Daniel U. Thibault
R & D pour la défense Canada - Valcartier (RDDC Valcartier) / Defence R&D Canada - Valcartier (DRDC Valcartier)
Cyber sécurité pour les missions essentielles (CME) / Mission Critical Cyber Security (MCCS)
Protection des systèmes et contremesures (PSC) / Systems Protection & Countermeasures (SPC)
2459 route de la Bravoure
Québec, QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
[Valcartier]\\vsi-wdut-o980, [Valcartier]\\edge
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada / Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>



More information about the lttng-dev mailing list