On 21/01/2014, at 2:14 PM, srean wrote:

> Is there a way to easily instrument Felix function calls to collect stats 
> about how long they are taking ?

Nope. You can of course build profiling versions of code. With gcc and clang 
and various
tools you can do things at the C++ level. To get profiling builds you'd need to 
first
make a profiling target, which is not trivial but not really that hard either: 
the system
is set up for this, however, you have to "hand configure" the target at the 
moment.
There is a tool to *copy* a configuration, but thereafter you have to hand 
modify it.
Also note clean rebuild and/or install will clobber this hand done work.

[I'm investigating how to fix this, but so far the only method of interaction 
that
seems to work as requires is to use a server to do the building and control
it with a web browser.. SDL may provide GUI stuff but it won't run on
a remote machine .. basic stuff like Ncurses is so ridiculously badly broken
it isn't even worth thinking about.. question and answer with plain stdio 
will work but then line editing rather sucks ..]

You can cheat a bit, and use your existing toolchain with extra switches
provided Felix passes them on to the C++ compiler.

In general: profiling properly is the devils work. It requires running your code
under a supervisor that pre-emptively interrupts the program to sample the
machine CPU program counters, and then later figures out what was
actually being executed. The profiling switches to the compiler make it generate
the required information for this analysis.

There's no easy way to do this at the C++ source code level. So whilst tracing
is possibly by using instrumentation in the Felix compile to inject stuff
into the C++ as required, this will never work for low level profiling.

Profiling *high level* functions is easy enough: just write a wrapper which is 
called
instead, and put timer in to measure the time. This is how the Felix compiler 
flxg
is instrumented to produce flxg_stats.txt -- it profiles at the "compiler 
phase" level
so I know which parts of the compiler are slowest (typically binding or 
optimisation,
but code generation can be slow as well).

So roughly the answer is: you have to do it the same way you would in C++
with the extra negative that you will have to read the generated C++ code to
discover what is actually being profiled.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to