Name Date Size #Lines LOC

..10-Aug-2022-

docs/H09-Aug-2022-361261

examples/H09-Aug-2022-218119

include/H09-Aug-2022-4,2781,512

scripts/H09-Aug-2022-4430

src/H09-Aug-2022-2,0021,372

tests/H09-Aug-2022-3,8312,656

thirdparty/H09-Aug-2022-197110

.gitignoreH A D09-Aug-2022446 3131

.gitmodulesH A D09-Aug-2022376 109

CMakeLists.txtH A D09-Aug-20222.7 KiB7663

DoxyfileH A D09-Aug-2022102.7 KiB2,4071,860

LICENSE.txtH A D09-Aug-202211.1 KiB203169

MakefileH A D09-Aug-20221.4 KiB6039

NonServerBuild.cmakeH A D09-Aug-20221.6 KiB3832

README.mdH A D09-Aug-20221.9 KiB5236

README.md

1# Phosphor
2
3[![License](https://img.shields.io/github/license/couchbaselabs/phosphor.svg)](LICENSE.txt)
4
5Phosphor is a high-performance event tracing framework for C++11 applications
6designed for use in Couchbase Server - specifically KV Engine and ForestDB.
7
8Event tracing is implemented in an application by instrumenting it as
9described in [phosphor.h](include/phosphor/phosphor.h). You can then enable
10and manage tracing using the management API described in
11[trace_log.h](include/phosphor/trace_log.h).
12
13## Example
14The following is an example of hypothetical instrumentation in memcached:
15
16    void performSet(ENGINE_HANDLE* engine, const char* key, const char* value) {
17        TRACE_EVENT_START("Memcached:Operation", "performSet", key);
18        // Perform a set operation
19        TRACE_EVENT_END0("Memcached:Operation", "performSet");
20    }
21
22The following is an example of enabling tracing with a fixed-style 5MB buffer:
23
24    phosphor::TraceConfig config(phosphor::BufferMode::fixed, 5 * 1024 * 1024);
25    phosphor::TraceLog::getInstance().start(config);
26
27Once the trace buffer becomes full you can retrieve it and iterate over it:
28
29    auto trace_buffer = phosphor::TraceLog::getInstance().getBuffer();
30    for(auto& event : *trace_buffer) {
31        std::cout << event << '\n';
32    }
33
34## Build
35
36Phosphor is written in C++11 and requires a mostly conforming compiler. Many
37early C++11 implementations used slow or even inaccurate clock sources which can
38cause issues with tracing.
39
40Phosphor can be built with CMake, a top level Makefile is provided for
41convenience. A simple `make compile` and `make test` will compile and run the
42tests.
43
44Phosphor can be built and tested with code coverage by running `make covered`.
45
46## Documentation
47
48Documentation for Phosphor can be found on
49[couchbase.github.io/phosphor](http://couchbase.github.io/phosphor/). The
50documentation is generated by Doxygen and can be done using `make
51docs` with the top level Makefile.
52