DECLARE_MASK_MAP(PC),
};
-#define S_OPTS "d:a:A:r:o:k"
+#define S_OPTS "d:a:A:r:o:kw:"
static struct option l_opts[] = {
{
.name = "dev",
.flag = NULL,
.val = 'k'
},
+ {
+ .name = "stopwatch",
+ .has_arg = 1,
+ .flag = NULL,
+ .val = 'w'
+ },
{
.name = NULL,
.has_arg = 0,
static char default_relay_path[] = "/relay";
struct stat st;
int i, c;
+ int stop_watch = 0;
int act_mask_tmp = 0;
while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) >= 0) {
case 'k':
kill_running_trace = 1;
break;
+ case 'w':
+ stop_watch = atoi(optarg);
+ if (stop_watch <= 0) {
+ fprintf(stderr,
+ "Invalid stopwatch value (%d secs)\n",
+ stop_watch);
+ return 1;
+ }
+ break;
default:
show_usage(argv[0]);
signal(SIGINT, handle_sigint);
signal(SIGHUP, handle_sigint);
signal(SIGTERM, handle_sigint);
+ signal(SIGALRM, handle_sigint);
atexit(stop_all_tracing);
+ if (stop_watch)
+ alarm(stop_watch);
+
while (!is_done())
sleep(1);
TRACEOPTS=""
PARSEOPTS=""
SUMMARIZE="-q" # quiet (no dev/cpu summary by default)
-USAGE="Usage: btrace [-s] [-t] [-S] [-a <trace>...] <dev>..."
+USAGE="Usage: btrace [-s] [-t] [-S] [-w N] [-a <trace>...] <dev>..."
DIRNAME=`dirname $0`
-while getopts "a:stS" c
+while getopts "a:stSw:" c
do
case $c in
a) TRACEOPTS=$TRACEOPTS" -a "$OPTARG" ";;
+ w) TRACEOPTS=$TRACEOPTS" -w "$OPTARG" ";;
s) PARSEOPTS=$PARSEOPTS" -s";;
t) PARSEOPTS=$PARSEOPTS" -t";;
S) SUMMARIZE="";;