46

As the title suggests. Many explanations are really vague, can anyone provide a more solid definition?

The term is used a lot in Android testing, but I don't think it's restricted to that platform.

barry
  • 4,037
  • 6
  • 41
  • 68

4 Answers4

24

Some performance measurement tools add instrumentation to the code. E.g. they may binary translate, and add instructions to read the timers at the beginning and end of functions. Or this instrumentation, this reading of the timers, may be added to assembly, or C code, by an automated tool, or a programmer.

Other performance measurement tools do not change the code that is being measured. E.g. UNIX prof sampling runs special code that is invoked at the timer interrupt, which generates a histogram of the instruction at which the interrupt is received.

Some tools are hybrid: e.g. UNIX gprof combines prof-style interrupt sampling with mcount instrumentation added by the compiler -pg option to count which functions call each other.

All performance measurement has overhead, but instrumentation tends to have more overhead than interrupt based sampling. On the other hand, instrumentation can measure more stuff.

Krazy Glew
  • 7,210
  • 2
  • 49
  • 62
  • What happens when new software is installed to an instrumented operating system. e.g. A new apk is installed to an instrumented android operating system. – Krishna Oza Aug 31 '18 at 06:53
  • 2
    I can’t speak to Android, but: one would hope that there would be a hook or callback, so that when new stuff is added the instrumentation management code is invoked, and can apply the instrumentation to the new code. However, this often does not happen (a) because there may be privilege issues, and (b) applying instrumentation itself can be exploited by malware. – Krazy Glew Aug 31 '18 at 13:26
14

Well, I visited this link and it said:

In context of computer programming, instrumentation refers to an ability to monitor or measure the level of a product's performance, to diagnose errors and to write trace information. Programmers implement instrumentation in the form of code instructions that monitor specific components in a system (for example, instructions may output logging information to appear on screen). When an application contains instrumentation code, it can be managed using a management tool. Instrumentation is necessary to review the performance of the application. Instrumentation approaches can be of two types, source instrumentation and binary instrumentation.

Happy coding

9

According to Oracle:

Instrumentation is the addition of byte-codes to methods for the purpose of gathering data to be utilized by tools. Since the changes are purely additive, these tools do not modify application state or behavior. Examples of such benign tools include monitoring agents, profilers, coverage analyzers, and event loggers.

maazza
  • 7,016
  • 15
  • 63
  • 96
AfamO
  • 849
  • 8
  • 7
4

Instrumentation is usually used in dynamic code analysis.

It differs from logging as instrumentation is usually done automatically by software, while logging needs human intelligence to insert the logging code.

Source

Community
  • 1
  • 1
Shajo
  • 873
  • 2
  • 11
  • 22