Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1094845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:01:53+00:00 2026-05-17T00:01:53+00:00

can you recommend lightweight cross-platform event recording/log library with the following features: simple interface

  • 0

can you recommend lightweight cross-platform event recording/log library with the following features:

  • simple interface
  • Incremental event recording (i.e. event++)
  • fast update
  • customizable report out put (for example iostream)
  • timestamps or os integration is not important

in principle it is not hard to make yourself one using map with string/integer keyvalue, but I would rather use one already written. I have looked at log4cxx but that seems like an overkill.

Thanks

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:01:54+00:00Added an answer on May 17, 2026 at 12:01 am

    this is prototype, final version is: http://code.google.com/p/asadchev/source/browse/trunk/projects/boost/utility/profiler.hpp

    #define UTILITY_EVENT_HPP
    
    #include "utility/timer.hpp"
    
    #include <string>
    #include <map>
    #include <boost/thread.hpp>
    #include <boost/tuple/tuple.hpp>
    
    #define PROFILE_FUNCTION(...)                                   \
        utility::profiler::event                                    \
        event__(utility::profiler::global[                          \
            utility::detail::profiler_event(__PRETTY_FUNCTION__)(__VA_ARGS__)])
    
    
    
    namespace utility {
    
        namespace detail {
            struct profiler_event {
                profiler_event(const std::string &key) : data_(key) {}
                operator const std::string&() const { return data_; }
                profiler_event& operator()(const std::string &key) {
                    data_ += (":" + key);
                    return *this;
                }
                profiler_event& operator()() { return *this; }
            private:
                std::string data_;
            };
        }
    
    
        struct profiler {
    
            typedef std::string event_key;
    
            struct event_data {
                event_data(): size_(0), value_(0) {}
                event_data(const event_data &e)
                    : size_(e.size_), value_(e.value_) {}
                event_data& operator+=(double t) {
                    boost::lock_guard<boost::mutex> lock(mutex_);
                     ++size_;
                     value_ += t;
                    return *this;
                }
                event_data& operator++() { return (*this += 1); }
                std::ostream& to_stream(std::ostream &ostream) const {
                    boost::lock_guard<boost::mutex> lock(mutex_);
                    ostream << value_ << "/" << size_;
                    return ostream;
                }
            private:
                typedef boost::tuple<profiler&, const event_key&> constructor;
                size_t size_;
                double value_;
                mutable boost::mutex mutex_;
            };
    
            struct event {
                event(event_data &data) : data_(data) {}
                ~event() {
                    // std::cout << timer_ << std::endl;
                    data_ += double(timer_);
                }
                event_data &data_;
                utility::timer timer_;
            };
    
            event_data& operator[](const event_key &key) {
                boost::lock_guard<boost::mutex> lock(mutex_);
                return events_[key];
            }
            std::ostream& to_stream(std::ostream &ostream) const {
                boost::lock_guard<boost::mutex> lock(mutex_);
                std::map<event_key, event_data>::const_iterator it = events_.begin();
                while (it != events_.end()) {
                    ostream << it->first << ": ";
                    it->second.to_stream(ostream);
                    ostream << std::endl;
                    ++it;
                }
                return ostream;
            }
            static profiler global;
        private:
            std::map<event_key, event_data> events_;
            mutable boost::mutex mutex_;
        };
    
        inline std::ostream& operator<<(std::ostream &ostream, const profiler &p) {
            return p.to_stream(ostream);
        }
    
    }
    
    
    #endif // UTILITY_EVENT_HPP
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone recommend a good library for generating an audio file, such as mp3,
Can anyone recommend software or a .NET library that will check for bounced emails
I'm wondering if anyone can recommend a good C++ tree implementation, hopefully one that
Are there any popular Mysql rss feeds you guys can recommend? IBM has random
can you recommend some good ASP.NET tutorials or a good book? Should I jump
Can anyone recommend some good resources that highlight the differences between Oracle and the
Can anyone recommend a good binary XML format? It's for a JavaME application, so
can anybody recommend some really good resources for how to get Apache authenticating users
Can anyone recommend a tool for quickly posting test messages onto a JMS queue?
Can anyone recommend some decent resources for a .NET developer who wishes to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.