Fix time-in-state annotations.

* Correct duration logic by using a global clock not per-{thread,
  freq} LAG().
* Preserve duration all the way through rather than recalculating it and
  thus losing the first interval for globals. Remove an intermediate
  table this way.
* Add a test. Add support for process stats packets to the Python trace
  generator. Unify add_packet() and add_process_tree_packet() while we
  are there.

Bug: 157216280
Change-Id: Ibff7bdfb6b53b3344d7cbfa5cdd518bf9831f915
diff --git a/test/trace_processor/synth_1.py b/test/trace_processor/synth_1.py
index dbead5c..88c466a 100644
--- a/test/trace_processor/synth_1.py
+++ b/test/trace_processor/synth_1.py
@@ -19,7 +19,7 @@
 import synth_common
 
 trace = synth_common.create_trace()
-trace.add_process_tree_packet()
+trace.add_packet()
 trace.add_process(1, 0, "init")
 trace.add_process(2, 1, "two_thread_process")
 trace.add_process(4, 1, "single_thread_process")