Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: src/libplatform/tracing/trace-buffer.h

Issue 2137013006: [Tracing] V8 Tracing Controller (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Start/StopTracing + TestTracingController Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SRC_LIBPLATFORM_TRACING_TRACE_BUFFER_H_
6 #define SRC_LIBPLATFORM_TRACING_TRACE_BUFFER_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "include/libplatform/v8-tracing.h"
12
13 namespace v8 {
14 namespace platform {
15 namespace tracing {
16
17 class TraceBufferRingBuffer : public TraceBuffer {
18 public:
19 TraceBufferRingBuffer(size_t max_chunks, TraceWriter* trace_writer);
20 ~TraceBufferRingBuffer();
21
22 TraceObject* AddTraceEvent(uint64_t* handle) override;
23 TraceObject* GetEventByHandle(uint64_t handle) override;
24 bool Flush() override;
25
26 private:
27 uint64_t MakeHandle(size_t chunk_index, uint32_t chunk_seq,
28 size_t event_index) const;
29 void ExtractHandle(uint64_t handle, size_t* chunk_index, uint32_t* chunk_seq,
30 size_t* event_index) const;
31 size_t Capacity() const { return max_chunks_ * TraceBufferChunk::kChunkSize; }
32 size_t NextChunkIndex(size_t index) const;
33
34 size_t max_chunks_;
35 std::unique_ptr<TraceWriter> trace_writer_;
36 std::vector<std::unique_ptr<TraceBufferChunk>> chunks_;
37 size_t chunk_index_;
38 bool is_empty_;
39 uint32_t current_chunk_seq_;
40 };
41
42 } // namespace tracing
43 } // namespace platform
44 } // namespace v8
45
46 #endif // SRC_LIBPLATFORM_TRACING_TRACE_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698