<commit_before># Phosphor

[![Unix Build Status](https://travis-ci.org/couchbaselabs/phosphor.svg?branch=master)](https://travis-ci.org/couchbaselabs/phosphor)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/gbioajys9fign7kj/branch/master?svg=true)](https://ci.appveyor.com/project/Chippiewill/phosphor-btb32/branch/master)
[![Server Build status](https://img.shields.io/jenkins/s/http/cv.jenkins.couchbase.com/phosphor.svg?maxAge=2592000&label=Server%20Build)](http://cv.jenkins.couchbase.com/job/phosphor/)
[![Coverage Status](https://coveralls.io/repos/github/couchbaselabs/phosphor/badge.svg?branch=master)](https://coveralls.io/github/couchbaselabs/phosphor?branch=master)
[![License](https://img.shields.io/github/license/couchbaselabs/phosphor.svg)](LICENSE.txt)

Phosphor is a high-performance event tracing framework for C++11 applications
designed for use in Couchbase Server - specifically KV Engine and ForestDB.

Event tracing is implemented in an application by instrumenting it as
described in [phosphor.h](include/phosphor/phosphor.h). You can then enable
and manage tracing using the management API described in
[trace_log.h](include/phosphor/trace_log.h).

## Example
The following is an example of hypothetical instrumentation in memcached:

    void performSet(ENGINE_HANDLE* engine, const char* key, const char* value) {
        TRACE_EVENT_START("Memcached:Operation", "performSet", key)
        // Perform a set operation
        TRACE_EVENT_END0("Memcached:Operation", "performSet")
    }

The following is an example of enabling tracing with a fixed-style 5MB buffer:


    phosphor::TraceLog::getInstance().start(TraceConfig(BufferMode::fixed, 5))

Once the trace buffer becomes full you can retrieve it and iterate over it:

    auto trace_buffer = phosphor::TraceLog::getInstance().getBuffer()
    for(auto& event : *trace_buffer) {
        std::cout << event << '\n';
    }
<commit_msg>Remove broken badges from README<commit_after># Phosphor

[![License](https://img.shields.io/github/license/couchbaselabs/phosphor.svg)](LICENSE.txt)

Phosphor is a high-performance event tracing framework for C++11 applications
designed for use in Couchbase Server - specifically KV Engine and ForestDB.

Event tracing is implemented in an application by instrumenting it as
described in [phosphor.h](include/phosphor/phosphor.h). You can then enable
and manage tracing using the management API described in
[trace_log.h](include/phosphor/trace_log.h).

## Example
The following is an example of hypothetical instrumentation in memcached:

    void performSet(ENGINE_HANDLE* engine, const char* key, const char* value) {
        TRACE_EVENT_START("Memcached:Operation", "performSet", key)
        // Perform a set operation
        TRACE_EVENT_END0("Memcached:Operation", "performSet")
    }

The following is an example of enabling tracing with a fixed-style 5MB buffer:


    phosphor::TraceLog::getInstance().start(TraceConfig(BufferMode::fixed, 5))

Once the trace buffer becomes full you can retrieve it and iterate over it:

    auto trace_buffer = phosphor::TraceLog::getInstance().getBuffer()
    for(auto& event : *trace_buffer) {
        std::cout << event << '\n';
    }

{'fraction_non_alphanumeric': 0.11494252873563218, 'fraction_numerical': 0.007145076110593352, 'mean_word_length': 5.018691588785047, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1389235', 'n_tokens_mistral': 1015, 'n_tokens_neox': 936, 'n_words': 253}