DevelopmentProfiling: Unterschied zwischen den Versionen

Aus FHEMWiki
(Die Seite wurde neu angelegt: „= Profiling FHEM = == What is profiling? == In software engineering, profiling ("program profiling", "software profiling") is a form of dynamic program analysi…“)
 
Keine Bearbeitungszusammenfassung
Zeile 19: Zeile 19:


This produces a subfolder names <tt>nytprof.</tt> Direct your browser to file <tt>index.html</tt> therein. You will get a bunch of information how FHEM spends its time.
This produces a subfolder names <tt>nytprof.</tt> Direct your browser to file <tt>index.html</tt> therein. You will get a bunch of information how FHEM spends its time.
[[Kategorie:Development]]

Version vom 13. Mai 2013, 20:23 Uhr

Profiling FHEM

What is profiling?

In software engineering, profiling ("program profiling", "software profiling") is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or frequency and duration of function calls. The most common use of profiling information is to aid program optimization. (from Wikipedia)

Profiling step-by-step

You need Devel::NYTProf from CPAN.

Start fhem.pl as follows:

perl -d:NYTProf /opt/fhem/fhem.pl /opt/fhem/conf/fhem.conf

Let it run for a while and then shut down FHEM.

You will find a bunch of nytprof.out files in /opt/fhem. nytprof.out contains the profile for the parent process and each nytprof.out.<pid> file contains the profile for a child process forked by the parent process. Not nytprof.out but the largest nytprof.out.<pid> file contains the profile of the master process since FHEM does an initial fork when it is ready.

You transfer the profile of the master process into something human-readable by issueing the command

nytprofhtml -f nytprof.out.<pid>

This produces a subfolder names nytprof. Direct your browser to file index.html therein. You will get a bunch of information how FHEM spends its time.