Skip to content

lanterna measure

Synopsis

Terminal window
lanterna measure <package> [options]

Description

The measure command is Lanterna’s primary entry point. It detects connected devices, selects the target platform, collects performance metrics for the specified duration, calculates a weighted composite score, and renders a terminal report.

On Android, metrics are collected via adb shell top, dumpsys meminfo, dumpsys gfxinfo, and Perfetto traces. On iOS, metrics are collected via xcrun xctrace record followed by xcrun xctrace export.

No app modifications are required. This is Tier 1 (external, zero-config) data collection.

Arguments

<package> (required)

The app package name (Android) or bundle ID (iOS) to measure. This must match the identifier of a currently running app on the target device.

Terminal window
# Android package name
lanterna measure com.example.myapp
# iOS bundle ID
lanterna measure com.example.MyApp

Options

FlagAliasDefaultDescription
--duration <seconds>-d10Measurement duration in seconds
--platform <ios|android>-pauto-detectForce the target platform
--device <id>auto-selectTarget a specific device by its ID
--output <path>-oExport the JSON report to a file
--baseline <path>-bCompare against a previous JSON report
--help-hShow help

Examples

Basic measurement

Terminal window
lanterna measure com.example.app

Custom duration

Terminal window
lanterna measure com.example.app --duration 30

Force iOS platform

Terminal window
lanterna measure com.example.app --platform ios

Target a specific device

Terminal window
lanterna measure com.example.app --device emulator-5554

Export a JSON report

Terminal window
lanterna measure com.example.app --output report.json

Compare against a baseline

Terminal window
lanterna measure com.example.app --baseline previous.json --output current.json

Exit Codes

CodeMeaning
0Measurement completed and the score is not in the Poor range (score ≥ 40)
1Score is Poor (below 40), or a regression was detected when using --baseline

When --baseline is provided, Lanterna compares each metric against the baseline values. If any metric has regressed beyond the configured threshold, the command exits with code 1 regardless of the overall score. This makes it suitable for use as a CI performance gate.