diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-11-26 15:01:29 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-11-26 15:01:29 +0000 |
commit | 2250a0e42a0fcad757f38121859ce7de10384df3 (patch) | |
tree | 91f1f793b136d70c3e215200384b11ead3a21be3 /trace_parser.hpp | |
parent | e90885a66a8053ee914ef22db96f13fba0ed1441 (diff) |
More efficient call representation.
Diffstat (limited to 'trace_parser.hpp')
-rw-r--r-- | trace_parser.hpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/trace_parser.hpp b/trace_parser.hpp index b77fc3e..5d51315 100644 --- a/trace_parser.hpp +++ b/trace_parser.hpp @@ -56,6 +56,9 @@ protected: typedef std::map<unsigned, Call *> callmap; callmap calls; + typedef std::map<size_t, Call::Signature *> FunctionMap; + FunctionMap functions; + typedef std::map<size_t, Bitmask::Signature *> BitmaskMap; BitmaskMap bitmasks; @@ -118,9 +121,26 @@ public: } void parse_enter(void) { - Call *call = new Call; + size_t id = read_uint(); + + Call::Signature *sig; + FunctionMap::const_iterator it = functions.find(id); + if (it == functions.end()) { + sig = new Call::Signature; + sig->name = read_string(); + unsigned size = read_uint(); + for (unsigned i = 0; i < size; ++i) { + sig->arg_names.push_back(read_string()); + } + functions[id] = sig; + } else { + sig = it->second; + } + assert(sig); + + Call *call = new Call(sig); call->no = next_call_no++; - call->name = read_name(); + parse_call_details(call); calls[call->no] = call; } @@ -160,12 +180,11 @@ public: void parse_arg(Call *call) { unsigned index = read_uint(); - std::string name = read_name(); Value *value = parse_value(); if (index >= call->args.size()) { call->args.resize(index + 1); } - call->args[index] = Arg(name, value); + call->args[index] = value; } Value *parse_value(void) { |