I am looking to measure the CPU time required to execute a PLECS standalone model. I am running the model through a simulation script, the same as wallclock is measured in the PLECS tutorials.
I am encountering a strange issue where the CPU time is not being measured properly, but the wallclock time is; the CPU time always shows zero time elapsed. I have attached a screenshot of the simulation script window and octave console showing the outputs. Any help is appreciated.
Jared, CPU can be a misleading measurement as it accounts for the CPU time of the Octave code, but not the execution time as Octave can be waiting on IO from other processes (i.e. PLECS).
Wall clock (tic/toc) is a better solution for benchmarking compared to cputime(). Another alternative is to use the Octave profiler.
Thanks for the answer, it helps me understand what is going on here. CPU time is very important to me, I specifically want to know the CPU time required for the PLECS process; it seems this cannot be measured directly? Your answer gives a list of wallclock times for each process, is it possible to get a list of CPU times for each process? I do not fully understand the framework so I may be misguided here.
Wall clock time is often a proxy for CPU time. I do not think there is a workable solution built into PLECS/Octave.
If you want to measure CPU time of PLECS then perhaps there’s an external profiling tool for the operating system you’re using? CPU time is reported to Octave through OS specific utilities (e.g. getrusage).