Instrumentation (software development)

from Wikipedia, the free encyclopedia

With instrumentation is in the software engineering supplementing of computer programs with special code designated to be able to examine their behavior. This can be inserted into the source code , the binary code or an intermediate code and evaluated with the help of tools. Instrumentation is used in software tests to determine test coverage and in profilers . The instrumentation can be carried out semi-automatically (GNU C / C ++ compiler -finstrument-functions) as well as automatically using special programs ( Tru64 UNIX atom, pin for x64 architectures). There are static, dynamic and hybrid approaches, each with different advantages and disadvantages. Also, there are programming interfaces standards such as the Application Response Measurement of response time measurement for Java and C .

Manual instrumentation

To illustrate, a source code excerpt in the Java programming language before and after the instrumentation.

public boolean istGerade(int zahl) {
  if (zahl % 2 == 0) {
     return true;
  } else {
     return false;
  }
}

Instrumentation adds source code in the following form:

[...]

private void protokolliereIstGeradeBetreten() {
  // Zähler "istGeradeBetreten" in einer Log-Datei hochzählen
  [...]
}

private void protokolliereIfBetreten() {
  // Zähler "ifBetreten" in einer Log-Datei hochzählen
  [...]
}

private void protokolliereElseBetreten() {
  // Zähler "elseBetreten" in einer Log-Datei hochzählen
  [...]
}

[...]

public boolean istGerade(int zahl) {
  protokolliereIstGeradeBetreten();
  if (zahl % 2 == 0) {
     protokolliereIfBetreten();
     return true;
  } else {
     protokolliereElseBetreten();
     return false;
  }
}

The program will then be executed. The log file can then be evaluated and, for example, it can be determined whether all three counters have been increased.

Individual evidence

  1. gcc / g ++ -finstrument-functions Compiler option gcc.gnu.org, accessed on February 5, 2016. (English)
  2. Pin - A Dynamic Binary Instrumentation Tool software.intel.com, accessed February 5, 2016. (English)