FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node/src/tracing/node_trace_buffer.h at test-https-req-split · BruceFletcher/node · GitHub
BruceFletcher
/
node
Public
forked from
nodejs/node
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node
/
src
/
tracing
/
node_trace_buffer.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
86 lines (70 loc) · 2.42 KB
Breadcrumbs
node
/
src
/
tracing
/
node_trace_buffer.h
Copy path
File metadata and controls
86 lines (70 loc) · 2.42 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
84
85
86
#
ifndef
SRC_TRACING_NODE_TRACE_BUFFER_H_
#
define
SRC_TRACING_NODE_TRACE_BUFFER_H_
#
include
"
node_mutex.h
"
#
include
"
tracing/node_trace_writer.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,
NodeTraceWriter* trace_writer);
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_;
NodeTraceWriter* trace_writer_;
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, NodeTraceWriter* trace_writer,
uv_loop_t
* tracing_loop);
~NodeTraceBuffer
();
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::unique_ptr<NodeTraceWriter> trace_writer_;
std::atomic<InternalTraceBuffer*> current_buf_;
InternalTraceBuffer buffer1_;
InternalTraceBuffer buffer2_;
};
}
//
namespace tracing
}
//
namespace node
#
endif
//
SRC_TRACING_NODE_TRACE_BUFFER_H_
Back
|
FazBrowse Home
|
New Git URL