[stdlib] Optimize critical path generation

Building on the existing idea of a critical path which is a chain
of tasks blocking a given task while it's asleep and get's woken up
by a process as opposed to an IRQ.

1. Introduced the following concepts:
a. self: This conveys just what a thread is doing on its
thread track. No critical paths involved.
b. stack: This is a stack of strings representing different properties
of a task in a critical path or in it's self path. These strings can be slices,
thread_states or process/thread names.
b. graph: Aggregated view of stack into a pprof.

2. Improved performance significantly by pre-computing the
following for the entire trace:
a. sched wakeup graph + thread_states (for critical path)
b. sched wakeup graph + slices (for critical path)
c. flattened slices + thread_states (for self path)
d. critical paths without thread_state or slice information

The only information that's recomputed on query is the span join of
(d) with (a), (b) and (c).

3. Removed the following APIs:
a. ancestors and descendants traversal of the sched wakeup graph
b. critical path slices and thread_states

Added the following APIs for:
a. critical path stack
b. critical path graph

The entire wakeup graph is still exposed in
|experimental_thread_executing_span_graph| and the span join with thread_states
and/or slices can be exposed in the future. We already computed it as an input
to generate critical paths.

Test: tools/diff_test_trace_processor.py out/android/trace_processor_shell --name-filter '.*thread_executing_span.*'
Change-Id: Id138dcf97b7e979b01c91fdc8d9b6183a5783622
diff --git a/tools/check_sql_modules.py b/tools/check_sql_modules.py
index 4ffa402..09df681 100755
--- a/tools/check_sql_modules.py
+++ b/tools/check_sql_modules.py
@@ -44,7 +44,8 @@
     ],
     ('/src/trace_processor/perfetto_sql/stdlib/experimental/'
      'thread_executing_span.sql'): [
-        'internal_wakeup', 'experimental_thread_executing_span_graph'
+        'internal_wakeup', 'experimental_thread_executing_span_graph',
+        'internal_critical_path', 'internal_wakeup_graph', 'experimental_thread_executing_span_graph'
     ],
     '/src/trace_processor/perfetto_sql/stdlib/experimental/flat_slices.sql': [
         'experimental_slice_flattened'