1 : // Copyright 2012 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Call trace event parsing classes.
16 :
17 : #ifndef SYZYGY_TRACE_PARSE_PARSE_ENGINE_RPC_H_
18 : #define SYZYGY_TRACE_PARSE_PARSE_ENGINE_RPC_H_
19 :
20 : #include "base/time.h"
21 : #include "base/files/file_path.h"
22 : #include "syzygy/trace/parse/parse_engine.h"
23 : #include "syzygy/trace/protocol/call_trace_defs.h"
24 :
25 m : namespace trace {
26 m : namespace parser {
27 :
28 m : class ParseEngineRpc : public ParseEngine {
29 m : public:
30 m : ParseEngineRpc();
31 m : virtual ~ParseEngineRpc();
32 :
33 : // @name ParseEngine implementation
34 : // @{
35 m : virtual bool IsRecognizedTraceFile(
36 m : const base::FilePath& trace_file_path) OVERRIDE;
37 m : virtual bool OpenTraceFile(
38 m : const base::FilePath& trace_file_path) OVERRIDE;
39 m : virtual bool ConsumeAllEvents() OVERRIDE;
40 m : virtual bool CloseAllTraceFiles() OVERRIDE;
41 : // @}
42 :
43 m : private:
44 : // A set of trace file paths.
45 m : typedef std::vector<base::FilePath> TraceFileSet;
46 :
47 : // An iterator over a set of trace file paths.
48 m : typedef TraceFileSet::iterator TraceFileIter;
49 :
50 : // Dispatches all of the events contained in the given trace file.
51 : //
52 : // For each segment in the trace file calls ConsumeSegmentEvents().
53 : //
54 : // @return true on success
55 m : bool ConsumeTraceFile(const base::FilePath& trace_file_path);
56 :
57 : // Dispactches all of the events in the given segment buffer.
58 : //
59 : // @param file_header the header information describing the trace file.
60 : // @param segment_header the header iformation describign the segment.
61 : // @param buffer the full segment data buffer.
62 : // @param buffer_length the length of the segment data buffer (in bytes).
63 : // @return true on success.
64 m : bool ConsumeSegmentEvents(const TraceFileHeader& file_header,
65 m : const TraceFileSegmentHeader& segment_header,
66 m : uint8* buffer,
67 m : size_t buffer_length);
68 :
69 : // The set of trace files to consume when ConsumeAllEvents() is called.
70 m : TraceFileSet trace_file_set_;
71 :
72 m : DISALLOW_COPY_AND_ASSIGN(ParseEngineRpc);
73 m : };
74 :
75 m : } // namespace trace::parser
76 m : } // namespace trace
77 :
78 : #endif // SYZYGY_TRACE_PARSE_PARSE_ENGINE_RPC_H_
|