From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Any Suggestion How To Accomplish A Debug Macro?
Date: Fri, 2 Jan 2015 15:52:28 -0600
Date: 2015-01-02T15:52:28-06:00 [thread overview]
Message-ID: <m873ut$vj3$1@loke.gir.dk> (raw)
In-Reply-To: fh7u81n706kr.131btl9yj1iz8.dlg@40tude.net
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:fh7u81n706kr.131btl9yj1iz8.dlg@40tude.net...
> On Fri, 02 Jan 2015 21:37:47 +0100, J-P. Rosen wrote:
...
> However, it would be interesting to consider how tracing could be better
> supported. I mean options:
>
> 1. To have zero-cost turned off tracing, e.g. some code modification
> techniques or maybe something else. After all we have zero-cost
> exceptions,
> why not tracing.
But "zero-cost exceptions" aren't really zero-cost, they just shift the cost
to handling. And that's already the case; virtually all of the cost of
tracing is when the tracing is enabled. (A Boolean compare being about the
cheapest operation on most targets.) About all one could do would be to keep
the tracing code out of the normal flow, which would decrease paging/caching
costs a bit when tracing is off -- but that would not make a noticable
difference on the vast majority of programs. It would be unlikely to be
worth the work.
> 2. Ideas for the compilation units structure modification which would
> allow
> to have tracing code physically separated from the functional code.
We've considered such ideas in the context of assertions, but nothing
proposed really looked like a proper part of Ada. For tracing, it would be
even harder, because tracing can be inserted anywhere in the flow of a
program (not just at particular places like most assertions). Moreover, in
both cases, there isn't a clear-cut boundary between them (for tracing,
that's primarily human-readable output, which often is needed anyway; for
assertions, that's predicate functions that you might want to use to insert
pre-tests before operations).
I use separate logging and trace management packages, which (combined with
my aversion to use clauses) show tracing code pretty well. It's not clear at
all that we could do better with syntax mechanisms.
Randy.
next prev parent reply other threads:[~2015-01-02 21:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-30 3:12 Any Suggestion How To Accomplish A Debug Macro? Hubert
2014-12-30 11:14 ` Simon Wright
2014-12-30 11:45 ` Hubert
2014-12-30 20:07 ` Brad Moore
2014-12-30 22:11 ` Randy Brukardt
2015-01-01 12:28 ` Georg Bauhaus
2015-01-02 20:37 ` J-P. Rosen
2015-01-02 21:13 ` Dmitry A. Kazakov
2015-01-02 21:52 ` Randy Brukardt [this message]
2015-01-02 22:17 ` Niklas Holsti
2014-12-31 0:15 ` Luke A. Guest
2014-12-30 16:24 ` sbelmont700
2014-12-30 18:21 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox