#include "trace_parser.hpp"
#include "trace_dump.hpp"
+#include "trace_callset.hpp"
enum ColorOption {
static bool verbose = false;
+static trace::CallSet calls(trace::FREQUENCY_ALL);
+
static const char *synopsis = "Dump given trace(s) to standard output.";
static void
<< synopsis << "\n"
"\n"
" -v, --verbose verbose output\n"
+ " --calls <CALLSET> Only dump specified calls\n"
" --color=<WHEN>\n"
" --colour=<WHEN> Colored syntax highlighting\n"
" WHEN is 'auto', 'always', or 'never'\n"
int i;
- for (i = 0; i < argc; ++i) {
+ for (i = 0; i < argc;) {
const char *arg = argv[i];
if (arg[0] != '-') {
break;
}
+ ++i;
+
if (!strcmp(arg, "--")) {
break;
} else if (!strcmp(arg, "--help")) {
} else if (strcmp(arg, "-v") == 0 ||
strcmp(arg, "--verbose") == 0) {
verbose = true;
+ } else if (!strcmp(arg, "--calls")) {
+ calls = trace::CallSet(argv[i++]);
} else if (!strcmp(arg, "--color=auto") ||
!strcmp(arg, "--colour=auto")) {
color = COLOR_OPTION_AUTO;
trace::Call *call;
while ((call = p.parse_call())) {
- if (verbose ||
- !(call->flags & trace::CALL_FLAG_VERBOSE)) {
- if (dumpThreadIds) {
- std::cout << std::hex << call->thread_id << std::dec << " ";
+ if (calls.contains(*call)) {
+ if (verbose ||
+ !(call->flags & trace::CALL_FLAG_VERBOSE)) {
+ if (dumpThreadIds) {
+ std::cout << std::hex << call->thread_id << std::dec << " ";
+ }
+ trace::dump(*call, std::cout, dumpFlags);
}
- trace::dump(*call, std::cout, dumpFlags);
}
delete call;
}