benjamin-bader / cppmetrics Goto Github PK
View Code? Open in Web Editor NEWA zero-dependency c++14 port of Dropwizard Metrics.
License: Apache License 2.0
A zero-dependency c++14 port of Dropwizard Metrics.
License: Apache License 2.0
Re: Git tag v0.1.1: Receiving this error using g++-5 through g++-7 on Ubuntu 18.04.2.
File is WeightedSnapshot.cc.
Since C++11, "isnan" is declared within the "std" namespace. Thus, for portability the the function must be properly qualified as "std::isnan". That will fix the problem.
Notice this was fixed 10 Apr 2018. Could a git tag be created for a version that includes the change?
Java uses a ConcurrentSkipListMap, whose salient characteristics are:
The STL doesn't have anything remotely like this, so we've fallen back on mutual exclusion - much to the detriment of performance of histograms and timers.
I just noticed, that the thread sanitizer complains about a data race between modify() and count() due to the dynamic allocation of the cells:
WARNING: ThreadSanitizer: data race (pid=1078583)
Read of size 8 at 0x7b500015d080 by thread T43:
#0 cppmetrics::LongAdder::Count() const cppmetrics/LongAdder.cc:152:9
Previous write of size 8 at 0x7b500015d080 by thread T8:
#0 cppmetrics::LongAdder::modify(long) cppmetrics/LongAdder.cc:186:28
#1 cppmetrics::LongAdder::Increment(long) cppmetrics/LongAdder.cc:138:3
Location is heap block of size 512 at 0x7b500015d000 allocated by main thread:
#0 operator new(unsigned long) /tmp/builder/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_new_delete.cpp:64:3
#1 __gnu_cxx::new_allocator<cppmetrics::LongAdder::Cell*>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/ext/new_allocator.h:104:27
#2 std::_Vector_base<cppmetrics::LongAdder::Cell*, std::allocator<cppmetrics::LongAdder::Cell*> >::_M_allocate(unsigned long) /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_vector.h:168:35
#3 std::vector<cppmetrics::LongAdder::Cell*, std::allocator<cppmetrics::LongAdder::Cell*> >::_M_fill_insert(__gnu_cxx::__normal_iterator<cppmetrics::LongAdder::Cell**, std::vector<cppmetrics::LongAdder::Cell*, std::allocator<cppmetrics::LongAdder::Cell*> > >, unsigned long, cppmetrics::LongAdder::Cell* const&) /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/vector.tcc:483:34
#4 std::vector<cppmetrics::LongAdder::Cell*, std::allocator<cppmetrics::LongAdder::Cell*> >::insert(__gnu_cxx::__normal_iterator<cppmetrics::LongAdder::Cell**, std::vector<cppmetrics::LongAdder::Cell*, std::allocator<cppmetrics::LongAdder::Cell*> > >, unsigned long, cppmetrics::LongAdder::Cell* const&) /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_vector.h:1024:9
#5 std::vector<cppmetrics::LongAdder::Cell*, std::allocator<cppmetrics::LongAdder::Cell*> >::resize(unsigned long, cppmetrics::LongAdder::Cell* const&) /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_vector.h:687:4
#6 cppmetrics::LongAdder::LongAdder() cppmetrics/LongAdder.cc:122:11
I shortened the stacks to the LongAdder code.
Maybe the cell pointers have to be atomic? Or is it correct to assume that the pointer is always atomically written/read?
Dropwizard metrics uses a LongAdder
to defer/avoid synchronization in their counter implementations. No such thing exists in the c++ stdlib, unfortunately, and counters definitely suffer for the lack. They're subtle things to implement, so I haven't attempted it, but it would be important to implement before using this in a high-throughput and/or low-latency service.
The method on timer that accepts a lambda action does not seem to work; it reports no time has passed. I'm not yet sure why, but should really look in to that one of these days!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.