CLI command to record and write results to a file
Hey,
I have the following use-case:
I'd like to start the profiler using the CLI tool and stop recording once I have manually executed a certain flow. Once i stopped the tool from execution I'd expect the tool it to write to a results file. Then I can inspect the results file with the web reporter (handy for creating quickly comparisons during dev).
I know that there is the possibility to write a script and instrument it to do the measurements, however, quickly typing a command feels way faster.
Is that something we could add? (I can also add it to the code just lmk 😊 )
(btw, I love this tool, thx for building it <3).
Hi @hannojg, danke schön for the nice feedback! ☺️
I also plan to improve the Flipper plugin which still has some issue, but I think having a pure CLI version like you said would be a great idea!
If you want to try it out, that'd be much appreciated of course!! ❤️
I think the plan would be:
- Add a
durationparameter to the profile command Since the c++ profiler outputs measures every 500ms, we can easily stop when we have enough - Export from cppProfiler.ts a
export const MEASURE_INTERVAL_MS = 500just so that we can reuse it - Migrate only this function https://github.com/bamlab/android-performance-profiler/blob/main/packages/e2e-performance/index.ts#L54 over to the
profilerpackage (I think it's fine for now if we add the dependency toreporterinsideprofiler. It's just the opposite we should avoid, to avoid a dependency onadbcommands in the reporter - Add a
jsonparameter to the profile command to specify we want to output to a JSON file (potentially passing the file path)
But feel free to suggest any improvement over this!
Hi @hannojg!
At long last, this has been implemented in #70 🥳 Checkout https://docs.flashlight.dev to see how to use it