Enabling profiling

34 views
Skip to first unread message

Heidi

unread,
Jun 8, 2019, 10:23:31 AM6/8/19
to OSQP
I want to retrieve the "run_time" value that is documented to belong to the OSQPInfo struct when solving the problem. I have used MATLAB to generate C-code.
However, it seems I have to enable the PROFILING macro to do so.

If I do it in the main .c file or in 'osqp.c' I get many errors like this:
"OSQPInfo has no member named 'update_time'".

So I was wondering how to enable PROFILING and where I should do it?

Thanks!

Ian McInerney

unread,
Jun 8, 2019, 10:45:54 AM6/8/19
to OSQP
Heidi,

The profiling features are not available when using the generated C code because they are very platform specific, and many embedded development chains might not provide the timing functions.

-Ian

Goran Banjac

unread,
Jun 8, 2019, 10:49:58 AM6/8/19
to OSQP
Hi Heidi,

As you can see from the cmake file, we disable PROFILING when using code generation (EMBEDDED flag enabled) because we want to avoid dependency on external libraries.

If you are using the generated code through its mex interface, then the solve function returns the solve_time as one of the outputs (see here for more details). Note that the timing is computed in emosqp_mex.c.

If you are using the generated code directly from C, then you should implement the timing functionality yourself. Here is an example on how to do that:
https://github.com/oxfordcontrol/osqp-matlab/blob/master/codegen/files_to_generate/emosqp_mex.c#L161-L164

Best,
Goran
Reply all
Reply to author
Forward
0 new messages