summaryrefslogtreecommitdiff
path: root/trace_parser.hpp
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-11-28 12:16:52 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-11-28 12:16:52 +0000
commit89851d0c9d794e37338ed3e9e4a993189ac0577f (patch)
treeb2d29b24370428d696d8dbac5fc4d7d2892d8182 /trace_parser.hpp
parent780219b243f4418c4e6f79415a5a33f8186b64d0 (diff)
Keep active calls in a list.
Diffstat (limited to 'trace_parser.hpp')
-rw-r--r--trace_parser.hpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/trace_parser.hpp b/trace_parser.hpp
index 5b1758d..f8eb9b5 100644
--- a/trace_parser.hpp
+++ b/trace_parser.hpp
@@ -31,6 +31,7 @@
#include <iostream>
#include <map>
+#include <list>
#include <string>
#include <zlib.h>
@@ -50,8 +51,8 @@ class Parser
protected:
gzFile file;
- typedef std::map<unsigned, Call *> callmap;
- callmap calls;
+ typedef std::list<Call *> CallList;
+ CallList calls;
typedef std::map<size_t, Call::Signature *> FunctionMap;
FunctionMap functions;
@@ -145,12 +146,21 @@ public:
call->no = next_call_no++;
parse_call_details(call);
- calls[call->no] = call;
+
+ calls.push_back(call);
}
Call *parse_leave(void) {
unsigned call_no = read_uint();
- Call *call = calls[call_no];
+
+ Call *call = NULL;
+ for (CallList::iterator it = calls.begin(); it != calls.end(); ++it) {
+ if ((*it)->no == call_no) {
+ call = *it;
+ calls.erase(it);
+ break;
+ }
+ }
assert(call);
if (!call) {
return NULL;