summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2012-05-08 15:20:43 +0300
committerJosé Fonseca <jose.r.fonseca@gmail.com>2012-05-17 10:34:01 +0100
commit6f07a844ee29e47fe44d68ea68661611aaa92363 (patch)
tree7714d901a1317ceb78d69a1a0a37c1b29ca12bd0 /cli
parent6cb4c0f6914cae0fc4442dbb64abe068ee3b4cf0 (diff)
filter based on thread_id
Signed-off-by: Imre Deak <imre.deak@intel.com> Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/cli_trim.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/cli/cli_trim.cpp b/cli/cli_trim.cpp
index 206e24e6..d9446822 100644
--- a/cli/cli_trim.cpp
+++ b/cli/cli_trim.cpp
@@ -47,14 +47,16 @@ usage(void)
<< synopsis << "\n"
"\n"
" -h, --help show this help message and exit\n"
- " --calls=CALLSET only trim specified calls\n"
+ " --calls=CALLSET only retain specified calls\n"
+ " --thread=THREAD_ID only retain calls from specified thread\n"
" -o, --output=TRACE_FILE output trace file\n"
"\n"
;
}
enum {
- CALLS_OPT = CHAR_MAX + 1,
+ CALLS_OPT = CHAR_MAX + 1,
+ THREAD_OPT,
};
const static char *
@@ -64,7 +66,8 @@ const static struct option
longOptions[] = {
{"help", no_argument, 0, 'h'},
{"calls", required_argument, 0, CALLS_OPT},
- {"output", optional_argument, 0, 'o'},
+ {"thread", required_argument, 0, THREAD_OPT},
+ {"output", required_argument, 0, 'o'},
{0, 0, 0, 0}
};
@@ -73,6 +76,7 @@ command(int argc, char *argv[])
{
std::string output;
trace::CallSet calls(trace::FREQUENCY_ALL);
+ int thread = -1;
int i;
int opt;
@@ -84,6 +88,9 @@ command(int argc, char *argv[])
case CALLS_OPT:
calls = trace::CallSet(optarg);
break;
+ case THREAD_OPT:
+ thread = atoi(optarg);
+ break;
case 'o':
output = optarg;
break;
@@ -122,7 +129,8 @@ command(int argc, char *argv[])
trace::Call *call;
while ((call = p.parse_call())) {
- if (calls.contains(*call)) {
+ if (calls.contains(*call) &&
+ (thread == -1 || call->thread_id == thread)) {
writer.writeCall(call);
}
delete call;