Giter Club home page Giter Club logo

adb-markers's Introduction

adb-markers

Generate markers to include in the Firefox Profiler from adb commands

Usage

Running node adb-markers.js will start a server on localhost:2222.

Adding markers to profiles captured by the Firefox Profiler through remote profiling

In Firefox 125 or later configured for remote profiling a Firefox instance on Android:

  • on the host computer, in about:config, set the devtools.performance.recording.markers.external-url preference to http://localhost:2222/markers.
  • use the 'power' preset (or any configuration that uses the 'power' feature) when starting the profiler.
  • when capturing the profile, the Firefox Profiler will automatically fetch additional markers from adb shell dumpsys batterystats and adb logcat, and add them to the profile.

Adding markers to a profile from an USB power meter

HTTP API

  • GET /markers?start=<start timestamp in ms>&end=<end timestamp in ms> returns JSON data containing markers that can be added to a gecko profile by the Firefox Profiler front-end. The data contains: an array of categories, a markers data table, and an array of marker schemas.
    The start timestamp should be profile.meta.startTime + profile.meta.profilingStartTime from the profile and the end timestamp should be profile.meta.startTime + profile.meta.profilingEndTime.
  • GET /profile will return a profile retrieved from http://localhost:2121/profile extended with markers from adb. You can view it by loading it in the Firefox Profiler.
  • GET /reset will issue adb commands meant to put the phone in a state where it will produce the data this script expects:
    • adb shell dumpsys battery unplug: Android only adds data to battery stats when using the device on battery or when charing the battery. It stops adding data once the battery is full. This command works around the issue by mocking an unplugged battery state.
    • adb shell dumpsys batterystats --reset: resets the batterystats history. For unkown reasons, the timestamps drift slowly over time (eg. off by a few minutes after a few days), so resetting the history when starting a profiling session increases the accuracy of marker timestamps.
    • adb shell dumpsys batterystats --enable full-history: make the batterystats history include events about processes.
  • Debugging APIs:
    • GET /dump: dump the raw output of adb shell dumpsys batterystats -c (-c here means 'checkin', ie the machine readable output format of batterystats).
    • GET /dump-verbose: dump the (mostly) human readable output of adb shell dumpsys batterystats.
    • GET /events: dump the batterystats events in plain text.
    • GET /events.json: dump the batterystats events as JSON objects.
    • GET /logcat.json: dump the last 1000 logcat messages as JSON objects.

adb-markers's People

Contributors

fqueze avatar

Stargazers

Adam Brouwers-Harries avatar

Watchers

Adam Brouwers-Harries avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.