[lldb-dev] fate of TimeValue

Pavel Labath via lldb-dev lldb-dev at lists.llvm.org
Fri Oct 7 21:30:13 PDT 2016


The llvm-dev thread seems to have fizzed out - I would assume they are
not interested in std::chrono. In any case, I've put the more
interesting patches I have in my stack up for review, so you have a
better idea of what I have in mind. and then we can decide what is the
fate of the utility functions there.

cheers,
pl

On 6 October 2016 at 18:01, Pavel Labath <labath at google.com> wrote:
> I see one usage of of chrono in the Fuzzer, and that's about it.
>
> On 6 October 2016 at 17:46, Zachary Turner <zturner at google.com> wrote:
>>
>> I'd love to move over to chrono. For Utility functions such as those you
>> propose probably we should consider whether they should go into llvm. Does
>> llvm currently use anything from chrono or have any chrono support functions
>> yet?
>> On Thu, Oct 6, 2016 at 5:39 PM Pavel Labath via lldb-dev
>> <lldb-dev at lists.llvm.org> wrote:
>>>
>>> Hello all,
>>>
>>> in line with the "deinventing the wheel" movement, I'd like to remove the
>>> TimeValue class from LLDB. I've done some research on a flight this week,
>>> and as far as I can tell all functionality can be easily replaced with
>>> appropriate usage of std::chrono::duration and time_point.
>>>
>>> The only parts that are missing are the ability to convert to/from legacy
>>> C types (struct timevalue, struct timespec), which can be replaced by
>>> utility functions.
>>>
>>> Also, I've found one use case particularly cumbersome to write in the c++
>>> way: writing out a duration as a fractional number of units (e.g.
>>> milliseconds). So, I'd propose adding the following utility function as well
>>> (unless someone knows a cleaner way to write this):
>>>
>>> template<typename DurOut, typename DurIn>
>>> double float_duration(DurIn dur) {
>>>   return std::chrono::duration_cast<std::chrono::duration<double,
>>> DurOut::period>>(dur).count();
>>> }
>>>
>>> Then, you can write float_duration<milliseconds>(dur) to get the duration
>>> as a fractional number of milliseconds (used in printing time deltas in a
>>> human readable fashion).
>>>
>>> Any thoughts or objections?
>>>
>>> pl
>>> _______________________________________________
>>> lldb-dev mailing list
>>> lldb-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
>


More information about the lldb-dev mailing list