octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: First plans on a profiler


From: Jordi Gutiérrez Hermoso
Subject: Re: First plans on a profiler
Date: Wed, 25 May 2011 08:41:38 -0500

On 25 May 2011 06:06, Daniel Kraft <address@hidden> wrote:
> On 24 May 2011 13:01, John W. Eaton <address@hidden> wrote:
>
>> I don't know how best to record the timings, but here is an
>> possible way:
>>
>>   * Define a class profile_data_accumulator. This class should
>>     probably be a singleton object since we likely only want one
>>     profiler at a time to be active and using a singleton helps to
>>     avoid initialization problems. There are other singleton
>>     objects in Octave and they all use a similar style, so it would
>>     be best to follow the style of the others.
>
> I was thinking about something similar -- and thanks for the hint
> with the already existing singletons, I'll then try to mimic their
> style of course.
>
> Just one thought I also had: Do we possibly want to allow for
> multiple profiler objects the user also has access to, like via
> Octave's OOP interface? So that he/she could have profilers in
> parallel and accumulate data on each of them based on the needs? I
> can't think of a situation when that would be really useful, though.
> So probably the singleton is just fine. (And it should not be too
> hard to change that later if we really would want to have multiple
> profilers possible.)

Perhaps I'm wrong, but singleton in me evokes an unpleasant knee-jerk
reaction that goes something to the tune of this:

     http://sites.google.com/site/steveyegge2/singleton-considered-stupid

If Octave gets improved parallelisation and threading support,
couldn't you potentially want to have one profiler per thread? In that
case, wouldn't it make sense to make a normal object instead of a
singleton? Or if we really do want a singleton, wouldn't a bunch of
free-standing functions in some namespace do just as well, instead of
trying to jam them all as static functions of a class? Singletons are
often just namespaced global objects, and C++ has other ways to
accomplish namespacing than classes.

Perhaps I'm not making any sense, though, so don't take my comments
too seriously.

- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]