$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [log] Boost.Log Formal Review
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-03-18 14:27:39
Hi,
----- Original Message -----
From: "Stewart, Robert" <Robert.Stewart_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, March 18, 2010 4:18 PM
Subject: Re: [boost] [log] Boost.Log Formal Review
>
> sam.gundry_at_[hidden] wrote:
>>
>> A concern, which again Andrey has mentioned during this
>> review, is the speed of Boost.DateTime formatting. From our
>> comparisons, it is about 3-5x slower than log4cxx. Is it
>> possible to have a bare-minimum date time formatter similar
>> to log4cxx's implemented? I wrote a quick little wrapper
>> using a customised strftime (for microseconds) with the most
>> basic caching (which log4cxx's formatter uses) and
>> performance was comparable.
>
> In our logging library, date/time formatting was likewise too sluggish. I now track midnight as a time_t, with the date string, and then compute the current time relative to midnight, do a little math, and the result is a very fast computation of the current time. Of course, I also have to determine if the current time is more than 24 hours since the cached midnight to detect when the cached values must be updated.
In Boost.Chrono there is a class t24_hours which is a view of a boost::chrono::duration<Rep, Period> providing accesors functions for
number of days, hours, minutes, seconds and nanoseconds.
Boost.Chrono provides also a formatter with a default format "%d days(s) %h:%m:%s.%n\n", where
a.. %d : days
b.. %h : hours
c.. %m : minutes
d.. %s : seconds
e.. %n : nanoseconds
The interface of basic_24_hours_formatter is quite specific to the needs of Stopwatches, but we can make an interface that is more adapted to your needs.
More info at https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Chrono
The files related are:
/boost/chrono/t24_hours.hpp
/boost/chrono/t24_hours_formatter.hpp
/libs/chrono/example/t24_hours_example.cpp
I will appreciate if you can tell me what is missing and how the interface can change so you can get waht you need.
Thanks,
Vicente