|
Boost : |
Subject: Re: [boost] [Review] Formal Review of Proposed Boost.Chrono LibraryStarts TOMORROW
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-11-15 17:45:20
----- Original Message -----
From: "vicente.botet" <vicente.botet_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, November 14, 2010 11:52 AM
Subject: Re: [boost] [Review] Formal Review of Proposed Boost.Chrono LibraryStarts TOMORROW
> ----- Original Message -----
> From: "joel falcou" <joel.falcou_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Thursday, November 11, 2010 9:25 PM
> Subject: Re: [boost] [Review] Formal Review of Proposed Boost.Chrono Library Starts TOMORROW
>
>
>>
>> On 11/11/10 20:40, John Bytheway wrote:
>>> Right; I see that. My point was that the implementation of getticks
>>> itself has lots of platform-specific code in it, and something
>>> equivalent might be usefully added to Boost (but probably not in
>>> Boost.Chrono).
>>
>> Can't boost.Chrono concept wraps aroudn the concept of cycles and
>> providde a wrapper around rdtsc adn its ilk ?
>> Or is it more a work for StopWatch ?
>
> Sorry for the late response, I missed this post.
>
> As I said in another post it is very simple for the user to define a clock based on whatever cycle count the user can provide:
>
> template <long long speed>
> struct cycle_count_clock
> {
> typedef typename boost::ratio_multiply<boost::ratio<speed>, boost::mega>::type frequency; // Mhz
> typedef typename boost::ratio_divide<boost::ratio<1>, frequency>::type period;
> typedef long long rep;
> typedef boost::chrono::duration<rep, period> duration;
> typedef boost::chrono::time_point<cycle_count_clock> time_point;
> static time_point now()
> {
> // return exact cycle count
> return time_point(duration(provided_by_the_user::getticks())); // access to clock cycle count
> }
> };
>
> Boost.Chrono could provide sych a class, but the getticks() function should be provided by the user. If someone is able to provide a portable getticks() function (I'm myself unable to do it) and include it in Boost, Boost.Chrono will definitely use it to provide this cycle_count_clock.
>
> StopWatch is at high level and builds on top of Boost.Chrono.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk