The INScope Real-time Performance Analyzer is a Windows application that allows you to trace execution of INtime applications. Trace information for thread switches, system calls, and interrupt handling appears in a graphical user interface with various tools available to allow system analysis. INScope also provides a set of interface libraries and an API that a user can call to instrument application code.
To start INScope, use one of these methods:
INScope's main screen displays.
To open a new trace:
If you have not previously connected to the node, INscope may have to download its real-time server module (RTScope.TMP). Otherwise, INscope queries the state of the previously loaded real-time server module and makes the controls match the state.
For example, if a trace is already started, INScope detects a trace in progress and enables the Pause and End Trace buttons. Once the server is found and the state identified, the Status field displays "RTScope Loaded" and the other trace controls are enabled.
To open a saved trace:
In order to use the INscope API, include file traceapi.h and link to traceapi.lib.
Before running traces, you must configure the trace to meet your needs. To configure a trace:
The main screen with the trace you specified displays.
Once a trace starts, it runs until a stop condition is met or until it is explicitly stopped. To temporarily stop the trace, use one of these methods:
Once a trace is paused, you can resume it using one of these methods:
You can configure INscope traces to stop for any/none/all of the following conditions:
To stop a trace, use one of these methods:
To display a trace, stop the trace, as described in Stopping a trace (above).
If you use the options in INscope GUI to stop the trace, trace data automatically displays.
After stopping a trace using the INScope Graphical Interface or if a stop condition is achieved, the trace data automatically displays.
However, if you start a trace and leave it running when you exit INScope or if you start a trace and then cancel the "Trace Control Dialog", the trace may complete before you restart INScope. If when you start INScope a trace is available on the RT Node you have selected, you will be asked if you would like to view that trace. Click "Yes" to view the trace.
You can instrument your application and use INscope to analyze trace data immediately leading up to a specific event. You can use the INscope API to programmatically start the trace when you have entered the critical part of your code, log user events for reference within the trace, and stop the trace when you detect the condition you want to analyze.
// Initialization is complete, start the real work start_RT_trace(); while(1) { log_RT_event(count++); GetAndProcessData(); if( TestConditionsAreMet() ) stop_RT_trace(); }
To see general trends in processor usage and in execution flow for your application:
You can use the thread menu items to navigate to different execution (run) segments of your application. The cursor measures times between events. To see properties of each run segment, thread, event, and trace, right click the element in question and select Properties.
To configure INscope to trace an interrupt:
To configure INscope to trace a system call layer:
In this scenario, an important thread in your application may be starved, suspended, or takes too long to process its data. The watchdog timer may be used to detect this condition and stop the trace so that you can observe what is causing the condition in the system.
// Inside Important Thread // Set the timeout value smaller than the timeout specified in INscope timeout = WATCHDOG_TIMEOUT / 2; start_RT_trace(); while(1) { RT_I_am_alive(); ret = ReceiveRtData(messageMailbox,&message,timeout); if( !ret && GetLastRtError()==E_TIME) continue; // Perform this thread's work... ProcessData(); }
Adding names to processes and threads in the trace makes trace data more meaningful.
These names then display in the trace to help you identify the processes and threads of interest.
If you use the INscope API to start traces programmatically, you may notice that the names do not display in the trace. To force INscope to retrieve these names, use log_RT_app_start after cataloging the names you want to display.
To . . . | Use this system call . . . |
---|---|
Retrieve the current state of the INscope RT Server Component and any current traces | get_RT_trace_state |
Log a user-defined event in the trace buffer which can be used for reference when viewing the trace | log_RT_event |
Force INscope to get the filename (or cataloged name) of the running process. | log_RT_app_start |
Pause a trace, writing no new information to the trace buffer until the trace resumes | pause_RT_trace |
Reset the watchdog timer | RT_I_am_alive |
Start a trace using the current configuration settings | start_RT_trace |
Stop the trace, lock the buffer, and send a notification to INscope that a trace complete | stop_RT_trace |
Resume a paused trace | resume_RT_trace |
Save a trace file | save_RT_trace |