Admin Production ni-theme
Current Publication

CVIProfSetCurrentThreadProfiling

LabWindows/CVI

CVIProfSetCurrentThreadProfiling

int CVIProfSetCurrentThreadProfiling (int newState);

Purpose

Enables or disables profiling in the calling thread. This function only affects LabWindows/CVI applications built with profiling enabledprofiling enabled.

Note Notes  
  • You must install the LabWindows/CVI Execution Profiler Toolkit to profile LabWindows/CVI applications.
  • The LabWindows/CVI Execution Profiler Toolkit can only profile source code compiled with the LabWindows/CVI compiler. Profiling source code compiled with third-party compilers is not supported.
  • Some callback functions are called from library-owned threads. If a callback you expect to be profiled is not appearing in the Profile Viewer, consider calling this function directly from that callback.
  • Function calls that occur when profiling is disabled are not reported in the Profile Viewer. However, if a function enables or disables profiling, that function's reported self time includes the total time of calls that occur even when profiling is disabled. The total time of the enabling/disabling function also reflects calls that occur when profiling is disabled.

(Linux) This function is not supported.

Parameters

Input
Name Type Description
newState int Specifies the new profiling state.

Specify a nonzero value or select Enabled in the function panel to enable profiling in the calling thread.

Pass 0 or select Disabled in the function panel to disable profiling in the calling thread.

Return Value

Name Type Description
status int Result of the function call.

Code Description
0 Operation completed successfully.
-1 Memory allocation failed in the Execution Profiler.
-2 An invalid argument was passed to the Execution Profiler.
-3 An invalid NULL pointer was passed to the Execution Profiler.
-4 Could not initialize the Execution Profiler.
-5 An unexpected fatal error occurred in the Execution Profiler.
-6 An unexpected error occurred in the Execution Profiler, probably because the program executed a non-local goto (lonjmp).

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 2009 and later

Examples

Refer to the following examples that use the CVIProfSetCurrentThreadProfiling function:

  • profiler\PriorityInversion.cws

    Open example
  • profiler\sort.cws

    Open example
  • profiler\search.cws

    Open example