Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Server-Timing

Generate Server-Timing headers interactively in modern C++11

Inpired by:

πŸ“Š View your server's metrics in @ChromeDevTools via Server Timing headers. Big thanks to longtime Firebug developer @sroussey for the patch! pic.twitter.com/OjDDIv0lLR

β€” Paul Irish (@paul_irish) February 7, 2017
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

Installation

The library is header-only. Just drop the servertiming.hpp in your project and use it. You'll need a modern C++11 compatible compiler though.

Usage

#include "servertiming.hpp"

ServerTiming timing();
timing.startTimer("Database Query");

// ... do something work-intensive

timing.stopTimer("Database Query");

// you can also add metrics without the timer function
// the time value is always in milliseconds!
timing.addMetric("Image Processing", 12365)

// ... use the header string within your server framework or whatever
std::string header = timing.generateHeader();

// this will output:
// database-query;dur=0.122;desc="Database Query",image-processing;dur=12.365;desc="Image Processing"

About

πŸ“Š Generate Server-Timing headers interactively in modern C++11

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages