GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — node/src/tracing/node_trace_buffer.h at main · synapse/node

Expand file tree

/

node_trace_buffer.h

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
83 lines (67 loc) · 2.28 KB
/

node_trace_buffer.h

Copy path

File metadata and controls

83 lines (67 loc) · 2.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef SRC_TRACING_NODE_TRACE_BUFFER_H_
#define SRC_TRACING_NODE_TRACE_BUFFER_H_
#include "tracing/agent.h"
#include "node_mutex.h"
#include "libplatform/v8-tracing.h"
#include <atomic>
namespace node {
namespace tracing {
using v8::platform::tracing::TraceBuffer;
using v8::platform::tracing::TraceBufferChunk;
using v8::platform::tracing::TraceObject;
// forward declaration
class NodeTraceBuffer;
class InternalTraceBuffer {
public:
InternalTraceBuffer(size_t max_chunks, uint32_t id, Agent* agent);
TraceObject* AddTraceEvent(uint64_t* handle);
TraceObject* GetEventByHandle(uint64_t handle);
void Flush(bool blocking);
bool IsFull() const {
return total_chunks_ == max_chunks_ && chunks_[total_chunks_ - 1]->IsFull();
}
bool IsFlushing() const {
return flushing_;
}
private:
uint64_t MakeHandle(size_t chunk_index, uint32_t chunk_seq,
size_t event_index) const;
void ExtractHandle(uint64_t handle, uint32_t* buffer_id, size_t* chunk_index,
uint32_t* chunk_seq, size_t* event_index) const;
size_t Capacity() const { return max_chunks_ * TraceBufferChunk::kChunkSize; }
Mutex mutex_;
bool flushing_;
size_t max_chunks_;
Agent* agent_;
std::vector<std::unique_ptr<TraceBufferChunk>> chunks_;
size_t total_chunks_ = 0;
uint32_t current_chunk_seq_ = 1;
uint32_t id_;
};
class NodeTraceBuffer : public TraceBuffer {
public:
NodeTraceBuffer(size_t max_chunks, Agent* agent, uv_loop_t* tracing_loop);
~NodeTraceBuffer() override;
TraceObject* AddTraceEvent(uint64_t* handle) override;
TraceObject* GetEventByHandle(uint64_t handle) override;
bool Flush() override;
static const size_t kBufferChunks = 1024;
private:
bool TryLoadAvailableBuffer();
static void NonBlockingFlushSignalCb(uv_async_t* signal);
static void ExitSignalCb(uv_async_t* signal);
uv_loop_t* tracing_loop_;
uv_async_t flush_signal_;
uv_async_t exit_signal_;
bool exited_ = false;
// Used exclusively for exit logic.
Mutex exit_mutex_;
// Used to wait until async handles have been closed.
ConditionVariable exit_cond_;
std::atomic<InternalTraceBuffer*> current_buf_;
InternalTraceBuffer buffer1_;
InternalTraceBuffer buffer2_;
};
} // namespace tracing
} // namespace node
#endif // SRC_TRACING_NODE_TRACE_BUFFER_H_
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.