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

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: Add Setters for TraceConfig categories Created 4 years, 4 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
« no previous file with comments | « src/libplatform/default-platform.cc ('k') | src/libplatform/tracing/trace-buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "src/base/platform/mutex.h"
13
14 namespace v8 {
15 namespace platform {
16 namespace tracing {
17
18 class TraceBufferRingBuffer : public TraceBuffer {
19 public:
20 TraceBufferRingBuffer(size_t max_chunks, TraceWriter* trace_writer);
21 ~TraceBufferRingBuffer();
22
23 TraceObject* AddTraceEvent(uint64_t* handle) override;
24 TraceObject* GetEventByHandle(uint64_t handle) override;
25 bool Flush() override;
26
27 private:
28 uint64_t MakeHandle(size_t chunk_index, uint32_t chunk_seq,
29 size_t event_index) const;
30 void ExtractHandle(uint64_t handle, size_t* chunk_index, uint32_t* chunk_seq,
31 size_t* event_index) const;
32 size_t Capacity() const { return max_chunks_ * TraceBufferChunk::kChunkSize; }
33 size_t NextChunkIndex(size_t index) const;
34
35 mutable base::Mutex mutex_;
36 size_t max_chunks_;
37 std::unique_ptr<TraceWriter> trace_writer_;
38 std::vector<std::unique_ptr<TraceBufferChunk>> chunks_;
39 size_t chunk_index_;
40 bool is_empty_ = true;
41 uint32_t current_chunk_seq_ = 1;
42 };
43
44 } // namespace tracing
45 } // namespace platform
46 } // namespace v8
47
48 #endif // SRC_LIBPLATFORM_TRACING_TRACE_BUFFER_H_
OLDNEW
« no previous file with comments | « src/libplatform/default-platform.cc ('k') | src/libplatform/tracing/trace-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698