diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:29:09 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:29:09 -0800 |
commit | 55a2c71f27d3e0b8344597c7f281e687cb7aeb1b (patch) | |
tree | ecd18b995aea8eeeb8b3823266280d41245bf0f7 /emulator/qtools/dmtrace.h | |
parent | 82ea7a177797b844b252effea5c7c7c5d63ea4ac (diff) | |
download | sdk-55a2c71f27d3e0b8344597c7f281e687cb7aeb1b.zip sdk-55a2c71f27d3e0b8344597c7f281e687cb7aeb1b.tar.gz sdk-55a2c71f27d3e0b8344597c7f281e687cb7aeb1b.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'emulator/qtools/dmtrace.h')
-rw-r--r-- | emulator/qtools/dmtrace.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/emulator/qtools/dmtrace.h b/emulator/qtools/dmtrace.h new file mode 100644 index 0000000..6e20921 --- /dev/null +++ b/emulator/qtools/dmtrace.h @@ -0,0 +1,61 @@ +// Copyright 2006 The Android Open Source Project + +#ifndef DMTRACE_H +#define DMTRACE_H + +#include <vector> + +class DmTrace { + public: + struct Header { + uint32_t magic; + uint16_t version; + uint16_t offset; + uint64_t date_time; + }; + + DmTrace(); + ~DmTrace(); + + void open(const char *dmtrace_file, uint64_t startTime); + void close(); + void addFunctionEntry(int methodId, uint32_t cycle, uint32_t pid); + void addFunctionExit(int methodId, uint32_t cycle, uint32_t pid); + void addFunction(int functionId, const char *name); + void addFunction(int functionId, const char *clazz, const char *method, + const char *sig); + void parseAndAddFunction(int functionId, const char *name); + void addThread(int threadId, const char *name); + void updateName(int threadId, const char *name); + + private: + static const Header header; + + struct ThreadRecord { + int id; + const char *name; + }; + + struct FunctionRecord { + int id; + const char *name; + }; + + void write2LE(FILE* fstream, unsigned short val); + void write4LE(FILE* fstream, unsigned int val); + void write8LE(FILE* fstream, unsigned long long val); + void writeHeader(FILE *fstream, uint64_t startTime); + void writeDataRecord(FILE *fstream, int threadId, + unsigned int methodVal, + unsigned int elapsedTime); + void writeKeyFile(FILE *fstream); + void writeThreads(FILE *fstream); + void writeFunctions(FILE *fstream); + + FILE *fData; + FILE *fTrace; + std::vector<ThreadRecord*> *threads; + std::vector<FunctionRecord*> *functions; +}; + +#endif // DMTRACE_H |