FastConfigSetup
The @oaklean/cli can be used to easily setup a .oaklean config file.
- Install the cli:
npm add --save-dev @oaklean/cli - Run the init script:
npx oak init - It will ask you which sensor interface should be used for energy measurements:
Select a sensor interface (recommended for your platform: perf)
None (pure cpu time measurements)
powermetrics (macOS only)
❯ perf (Linux only)
windows (Windows only)
energy measurements on Linux (Intel & AMD CPUs only)
- The cli asks you to confirm your choice and generates a valid
.oakleanconfig file for you:
? Select a sensor interface (recommended for your platform: perf) perf (Linux only)
{
"exportOptions": {
"outDir": "profiles/",
"outHistoryDir": "profiles_history/",
"rootDir": "./",
"exportV8Profile": false,
"exportReport": true,
"exportSensorInterfaceData": false
},
"projectOptions": {
"identifier": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"runtimeOptions": {
"seeds": {},
"v8": {
"cpu": {
"sampleInterval": 1
}
},
"sensorInterface": {
"type": "perf",
"options": {
"outputFilePath": "energy-measurements.txt",
"sampleInterval": 100
}
}
}
}
? Is this OK? (yes) (Y/n)
Available Sensor Interfaces
| SensorInterface | Operating System |
|---|---|
| powermetrics | macOS |
| perf | linux |
| windows | windows |
If you want to how to setup the Sensor Interfaces and how to make them work with Docker you can read more about it here
⚠️ Most Sensor Interfaces need root privileges
Look into the Sensor Interface Docs to see how you can run them without root privileges
🔍 How measurements work
During the test execution measurements are collected with a sample based approach. So for every n - microseconds it collects a v8 cpu profile and energy measurements of the sensor interface. You can adjust the sampling rate with thesampleIntervaloptions in the.oakleanconfig file above.