Giter VIP home page Giter VIP logo

Comments (5)

LalitMaganti avatar LalitMaganti commented on May 30, 2024

Couple of notes:

  1. The slices correspond to the time the process was running. This allows you to pinpoint exactly on which CPU the process was running
  2. CPU utilization is a terrible metric on Android because it doesn't take into account frequency, idle state, throttling, core type etc so gives a very inaccurate perspective of how much work the process is doing

If you insist on using CPU utilization, you can do something like this to get a utilization every 1ms:

INCLUDE PERFETTO MODULE common.timestamps;

DROP TABLE IF EXISTS win;
CREATE VIRTUAL TABLE win USING window;
UPDATE win SET window_start=TRACE_START(), window_dur=TRACE_DUR(), quantum=1e6;

CREATE OR REPLACE PERFETTO VIEW system_server_sched AS
SELECT ts, dur, utid, sched.id AS sched_id
FROM sched
JOIN thread USING (utid)
JOIN process USING (upid)
WHERE process.name = 'system_server';

DROP TABLE IF EXISTS sys_server_util;
CREATE VIRTUAL TABLE sys_server_util USING SPAN_LEFT_JOIN(win, system_server_sched PARTITIONED utid);

SELECT SUM(IIF(sched_id IS NOT NULL, dur, 0)) / 1e6 AS utilization, quantum_ts AS millisecond_since_start
FROM sys_server_util
GROUP BY 2;

from perfetto.

wjj1928 avatar wjj1928 commented on May 30, 2024

Thanks, Is this sql command runnable in sqlite3? when I paste it in sqlite3 and run, report below error:

Runtime error: no such module: window

from perfetto.

LalitMaganti avatar LalitMaganti commented on May 30, 2024

No. This is a PerfettoSQL query which can only be executed by the trace processor.

from perfetto.

wjj1928 avatar wjj1928 commented on May 30, 2024

Try trace_process with below command:

.\trace_processor_shell.exe -q .\sql.txt .\boottrace.perfetto-trace [638.424] oto_trace_reader.cc:254 It is strongly recommended to have flush_period_ms set when write_into_file is turned on. This trace will be loaded fully into memory before sorting which increases the likelihood of OOMs.
[640.325] processor_shell.cc:1627 Trace loaded: 79.69 MB in 1.90s (41.9 MB/s)
Traceback (most recent call last):
File "stdin" line 3 col 29
UPDATE win SET window_start=TRACE_START(), window_dur=TRACE_DUR(), quantum=1e6
^
no such function: TRACE_START

Is this the proper way? or need some special config file to capture trace?

from perfetto.

LalitMaganti avatar LalitMaganti commented on May 30, 2024

Sorry I was prototyping this query in the UI: I was missing the line:

INCLUDE PERFETTO MODULE common.timestamps;

at the start of the query.

from perfetto.

Related Issues (20)

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.