machineName is an in-build function of Apache JMeter and its type is ‘Information’. This function simply returns the name of the machine on which JMeter runs. By the way, JMeter in-build functions are divided into eight categories which are:
- Information
- Input
- Calculation
- Formatting
- Scripting
- Properties
- Variables
- Strings

Let’s discuss about machineName function:
Syntax: ${__machineName}
Type: Information
Purpose: To get the name of the machine on which JMeter runs.
Example: Refer to the below screenshot.

Input Argument: No input value can pass in the machineName function.
Return Value: A string i.e. the name of the JMeter machine
Use: This function is helpful when a performance test runs in a distributed mode i.e. master-slave architecture and you want to filter out the requests based on the load generator (slave). But this is a rare case scenario. The machineName function is also used to print the name in the log as a basic information collection process.
Additional Information:
- The machineName function uses the Java method InetAddress.getLocalHost() and passes it to getHostName()
- The function can be used as ${__machineName()}
Related Functions:
You may be interested: