Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb: Use C++11 std::chrono
Date: Wed, 23 Nov 2016 02:27:00 -0000	[thread overview]
Message-ID: <cbb806e6b6984e40001569e568fcdf96@polymtl.ca> (raw)
In-Reply-To: <4dc8d860-16f0-65cc-796c-da240d8ffd9f@redhat.com>

On 2016-11-22 21:17, Pedro Alves wrote:
> I kept them (from v1) for type-safety: it makes it impossible to swap
> the arguments to this new now() method by mistake, or compare old
> system time with new user time by mistake.  E.g.:
> 
> /usr/include/c++/5.3.1/chrono:650:7: note: candidate: template<class
> _Clock, class _Dur1, class _Dur2> constexpr typename
> std::common_type<_Duration1, _Duration2>::type
> std::chrono::operator-(const std::chrono::time_point<_Clock,
> _Duration1>&, const std::chrono::time_point<_Clock, _Duration2>&)
>        operator-(const time_point<_Clock, _Dur1>& __lhs,
>        ^
> /usr/include/c++/5.3.1/chrono:650:7: note:   template argument
> deduction/substitution failed:
> src/gdb/mi/mi-main.c:2493:48: note:   deduced conflicting types for
> parameter ‘_Clock’ (‘system_cpu_time_clock’ and ‘user_cpu_time_clock’)
>    duration<double> utime = end->stime - start->utime;
>                                                 ^
> 
> Would you still prefer I remove those?

That sounds useful, I'm convinced.

>> Unrelated: for future work, it looks like an std::priority_queue would
>> be a nice match for timer_list.
> 
> Maybe, but we'd need to inherit from it in order to be able to
> delete timers that are not at the top of the heap.  A set or
> multiset would be other options.

You're right:

https://stackoverflow.com/questions/19467485/c-priority-queue-removing-element-not-at-top

Perhaps that's a bit too much for the amount of timers we usually have 
though...


  reply	other threads:[~2016-11-23  2:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 17:15 [PATCH] " Pedro Alves
2016-11-17 22:15 ` Simon Marchi
2016-11-23  0:59   ` [PATCH v2] " Pedro Alves
2016-11-23  2:01     ` Simon Marchi
2016-11-23  2:17       ` Pedro Alves
2016-11-23  2:27         ` Simon Marchi [this message]
2016-11-23  2:36           ` Pedro Alves
2016-11-23  2:57             ` Simon Marchi
2016-11-23 14:48               ` Simon Marchi
2016-11-23 16:02                 ` Pedro Alves
2016-11-23 16:11                   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbb806e6b6984e40001569e568fcdf96@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox