Code Monkey home page Code Monkey logo

cppmetrics's People

Contributors

benjamin-bader avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cppmetrics's Issues

'isnan' was not declared in this scope

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?

Find alternative to std::map in ExponentiallyDecayingReservoir

Java uses a ConcurrentSkipListMap, whose salient characteristics are:

  1. It's threadsafe in that multiple threads can update it without significant contention
  2. It is ordered - we can efficiently iterate keys in order, and find the lowest/highest key.

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.

Thread Sanitizer complains about a data race

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?

Find an alternative to atomics for counters

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.

Timer is broken, somehow

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.