flashlight icon indicating copy to clipboard operation
flashlight copied to clipboard

CLI command to record and write results to a file

Open hannojg opened this issue 3 years ago • 1 comments

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).

hannojg avatar Oct 15 '22 16:10 hannojg

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:

  1. Add a duration parameter to the profile command Since the c++ profiler outputs measures every 500ms, we can easily stop when we have enough
  2. Export from cppProfiler.ts a export const MEASURE_INTERVAL_MS = 500 just so that we can reuse it
  3. Migrate only this function https://github.com/bamlab/android-performance-profiler/blob/main/packages/e2e-performance/index.ts#L54 over to the profiler package (I think it's fine for now if we add the dependency to reporter inside profiler. It's just the opposite we should avoid, to avoid a dependency on adb commands in the reporter
  4. Add a json parameter 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!

Almouro avatar Oct 17 '22 13:10 Almouro

Hi @hannojg!

At long last, this has been implemented in #70 🥳 Checkout https://docs.flashlight.dev to see how to use it

Almouro avatar Feb 06 '23 14:02 Almouro