Using Global Hot Keys in Intel® VTune™ Amplifier

By Kevin P O'Leary,

Published:09/04/2012   Last Updated:09/04/2012




A global hot key is a mechanism whereby you associate a combination of keystrokes with an action. For example, on Windows* the key combination, “Ctrl-Alt-Del”, performs a system action. Both Windows* and Linux* have standard solutions for assigning an action to a key or key combination. By using VTune Amplifier's command line scripting, it is possible to control the data collection and display of results using a global hot key.




The global hotkey techniques are different for Linux and Windows, the following first describes the process on Linux followed by Windows.




The most common hot key manager available for X-windows is xbindkeys. To use it for Amplifier collection control, do the following:

  • Download the xbindkeys here.
  • Configure, make, install as described in the package documentation. If Guile has not been installed on the system then xbindkeys needs to disable this feature explicitly.   Execute "./configure --disable-guile"..
  • Run "xbindkeys --defaults > $HOME/.xbindkeysrc" to create the default key bindings file, then add two commands to it by pasting the following four lines:




          "~/ start"




           control+shift + s




           "~/ finish"




           control+shift + f



  • In this script, duration of the data collection is set by the variable AXE_DURATION and specifies the number of seconds to collect data. This duration time can be modified or specified as “unlimited”. In addition a collection can also be stopped by the stop hot key.
  • Before you define your hot key you should verify that the sequence of key strokes is not being used by another application. For example, on Ubuntu systems you can view keyboard shortcuts using the System->Preferences->Keyboard Shortcuts dialog.
  • Create an script in your home directory with the following respective content (adjusting AXE_HOME to your installation path):
#!/bin/bash   RESULT_DIR_BASE=/tmp/amplxe-auto-result AXE_HOME=/opt/intel/vtune_amplifier_xe_2011 AXE_ATYPE=lightweight-hotspots AXE_DURATION=120   if [[ $# -ne 1 || ( "$1" != "start" && "$1" != "finish" ) ]] then     echo "Usage: `basename $0` {start | finish}" >&2     exit 1 fi   if [[ "$1" == "start" ]] ; then     echo "Profiling system-wide with Amplifier XE, press CTRL-SHIFT-F to finish..."     rm -rf "${RESULT_DIR_BASE}.1" || exit 1     if [ -d "${RESULT_DIR_BASE}.0" ]; then mv "${RESULT_DIR_BASE}.0" "${RESULT_DIR_BASE}.1" ; fi     xterm -e "${AXE_HOME}/bin64/amplxe-cl" -c "${AXE_ATYPE}" -duration ${AXE_DURATION} -r "${RESULT_DIR_BASE}.0"     "${AXE_HOME}/bin64/amplxe-gui" "${RESULT_DIR_BASE}.0" else     "${AXE_HOME}/bin64/amplxe-cl" -C stop -r "${RESULT_DIR_BASE}.0" fi
  • Make sure to set the executable bit on the script.
  • Run xbindkeys in the background by executing the command "xbindkeys &".



On Windows you can use the standard OS capability to create a shortcut to a command and set a hot key for it:

@echo off   set RESULT_DIR_BASE=%TMP%amplxe-auto-result set AXE_HOME=C:Program Files (x86)IntelVTune Amplifier XE 2011 set AXE_ATYPE=lightweight-hotspots set AXE_DURATION=120  if "%1" == "start" goto :ok if "%1" == "finish" goto :ok   echo Usage: axe-hot-profile.bat {start ^| finish} >&2 exit /b 1   :ok   if "%1" == "start" (     echo Profiling system-wide with Amplifier XE, press CTRL-SHIFT-F to finish...     if exist "%RESULT_DIR_BASE%.1" (         del /s /q "%RESULT_DIR_BASE%.1" || exit /b 1     )     if exist "%RESULT_DIR_BASE%.0" (         move "%RESULT_DIR_BASE%.0" "%RESULT_DIR_BASE%.1"     )     if exist "%RESULT_DIR_BASE%.0" (         echo Couldn't rename the auto result directory -- GUI session is running?         exit /b 2     )     "%AXE_HOME%bin32amplxe-cl.exe" -c "%AXE_ATYPE%" -duration %AXE_DURATION% -r "%RESULT_DIR_BASE%.0"     "%AXE_HOME%bin32amplxe-gui.exe" "%RESULT_DIR_BASE%.0" ) else (     "%AXE_HOME%bin32amplxe-cl.exe" -command stop -r "%RESULT_DIR_BASE%.0" )
  • Right-click on the Windows desktop and select New -> Shortcut. In the wizard, specify for the location of the command a string like "<path to the batch file> start". Click "OK".
  • Right-click the shortcut and select Properties. In the dialog select "Shortcut key" and press CTRL-SHIFT-S to set that as the hot key for starting the collection.
  • Repeat the two steps again and create a shortcut for "<path to the batch file> finish" command setting CTRL-SHIFT-F as the hot key.

Hot Keys in Action

Performing start/stop with a single hot key


It is possible to use a single hotkey to do both start and stop of a collection. There are several ways to achieve this. In the method presented, you will need to use a file to record when Amplifier is in the “running” state. If running, then the hot key will perform a “stop” function, if not running then a collection will be started. The following is a snippet that shows this functionality on Windows.


    if exist "%RESULT_DIR_BASE%.running" (

        echo Stopping collection

        ... Code of collection stop ...

        del "%RESULT_DIR_BASE%.running"

    ) else (

        echo Starting collection

        type NUL >  "%RESULT_DIR_BASE%.running"

        ... Code of collection startup ...

        del "%RESULT_DIR_BASE%.running


Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804