• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1-- For each heap graph dump (upid, ts), builds a flamegraph and outputs:
2-- * total_objects_size: the sum of the size (native + java) of all the
3--   reachable objects
4-- * total_flamegraph_size: the sum of the cumulative size of the roots in the
5--   flamegraph
6-- If the flamegraph has been built correctly, the numbers should match.
7SELECT
8  obj.upid AS upid,
9  obj.graph_sample_ts AS ts,
10  SUM(obj.self_size + obj.native_size) AS total_objects_size,
11  (
12    SELECT SUM(cumulative_size)
13    FROM experimental_flamegraph
14    WHERE experimental_flamegraph.upid = obj.upid
15      AND experimental_flamegraph.ts = obj.graph_sample_ts
16      AND profile_type = 'graph'
17      AND depth = 0 -- only the roots
18  ) AS total_flamegraph_size
19FROM
20  heap_graph_object AS obj
21WHERE
22  obj.reachable != 0
23GROUP BY obj.upid, obj.graph_sample_ts
24