Performance and Timeline data in Appium

Appium connects to the browser using the remote debugging protocol. As a
result, no other client can take up the connection. Is there a way in
appium to get the timeline? I see that no rest call defined it.
ChromeDriver implements a logType=performance to get the timeline data.
Does it make sense for appium to support similar functionality?

1 Like

I am working on creating a pull request for this. The idea is to reuse the webkit remote debug interface that appium already uses. When the desiredCapabilities has {loggingPreferences : {performance: ‘ALL’} }, Timeline.start shall be called in the remote debugging.

We would then listen to eventRecorded event and save the events in a buffer.

Everytime the user calls getLog(‘performance’), the buffer is returned and flushed.
This is how ChromeDriver’s log(‘performance’) is implemented.

The only problem I see with this approach is an overflow of buffer, bu we could restrict the count of events in the buffer.

Here is my first attempt at it. I am able to get timeline events. Now I need to send them whenever the logs are asked for, and flush the data.

github.com/axemclion/appium/commit/perf

Would love any comments on this code. Would this break anything ?

Here is what the code does basically

  1. Check if I need to start perf Logging
  2. Wait till a context is set. When context is set, start timeline and listen to timeline events
  3. Store all timeline events, and send it back when asked for.

Here is the pull request with the changes that enable performance logging

github.com/appium/appium/pull/3530

This pull request has now been accepted. Performance logs for iOS can be started using loggingPrefs:{performance:‘ALL’} capability

1 Like

@axemclion,

I was wondering whether I can configure browser-perf tool to my existing iOS tests(Appium+Java).
When I start browser-perf with appium it launches the app, and it relaunches the app when I run my java tests … please let me know whether I can run my Java tests and browser-perf together and run the tests to get the metrics.

Thanks,
Amarnath Rayudu

Browser-perf only measures the performance of webviews. You can use the tool with Java, but I would suggest simply fetching the performance log using Java instead and manipulating it.