| Non-Confidential - REL | 101545__00_en | |||
| ||||
| Home > The Graphics Analyzer interface > Scripting view | ||||
The user interface might not have all the tools that you require to extract or analyze information that is retrieved from the target device. Therefore Graphics Analyzer has a Python scripting environment that allows you to directly interface with the Graphics Analyzer trace model. You can either perform an analysis natively in Python, or output the data that you need to an external file.
The Scripting view contains a Jython interpreter that implements the Python 2.7.0 specification. The interpreter supports the standard Python syntax and the Python standard library.
There is one interpreter per trace file. These interpreters cannot share data. Closing the Scripting view closes all interpreters. The interpreter supports loading script code in the following forms:
For convenience, the interpreter is initialized with two extra global variables:
For more information about these objects, or any other Graphics Analyzer object, use the built-in Python help function to print API documentation. For example:
help(trace)
Graphics Analyzer also comes with some sample scripts in <install_directory>/samples/scripts/ that provide examples of different ways to perform analysis on a trace object.
The scripting console allows you to interact with the Jython interpreter.
You can use the Up and Down keys to move through a history of the commands you have previously executed.
Clicking Interrupt
causes any running script and any created threads to stop.
Clear
allows you to clear the output text area.
To reset the interpreter back to its original state, click Reset
.
The Scripting view contains an interactive interpreter, but for more complicated analysis it is easier to write a script in a separate Python file. The Scripting view also allows you to load Python scripts, or directories of Python scripts, from your file system. Graphics Analyzer only loads scripting files with the .py extension.
The script locations that you load are stored in your workspace and are persistent across runs of Graphics Analyzer.
To load a single script, click Add Script
.
To load a directory, click Add Directory
. File-system changes to this directory are reflected in Graphics Analyzer.
To remove any top-level item, click Remove
. The file and directory on the file system are not affected.
Scripts are loaded and displayed in a staging area next to the interpreter. To execute a script, either double-click it or highlight it in the staging area and either right-click and select Run or press the R key.
The scripting environment is powerful, but also potentially memory intensive. The following tips might help improve the performance of your scripts:
del keyword or click Reset to re-initialize the scripting environment, deleting all references.