tp: move and rename ftrace_utils -> types/task_state

Change-Id: I39472aa1c57c95bbf2ce53d883fef1003d10b119
diff --git a/Android.bp b/Android.bp
index 8e80a31..12c79b2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -6525,7 +6525,6 @@
   name: "perfetto_src_trace_processor_storage_full",
   srcs: [
     "src/trace_processor/additional_modules.cc",
-    "src/trace_processor/ftrace_utils.cc",
     "src/trace_processor/importers/ftrace/binder_tracker.cc",
     "src/trace_processor/importers/ftrace/ftrace_descriptors.cc",
     "src/trace_processor/importers/ftrace/ftrace_module_impl.cc",
@@ -6634,10 +6633,19 @@
   name: "perfetto_src_trace_processor_types_types",
   srcs: [
     "src/trace_processor/types/gfp_flags.cc",
+    "src/trace_processor/types/task_state.cc",
     "src/trace_processor/types/variadic.cc",
   ],
 }
 
+// GN: //src/trace_processor/types:unittests
+filegroup {
+  name: "perfetto_src_trace_processor_types_unittests",
+  srcs: [
+    "src/trace_processor/types/task_state_unittests.cc",
+  ],
+}
+
 // GN: //src/trace_processor:unittests
 filegroup {
   name: "perfetto_src_trace_processor_unittests",
@@ -6646,7 +6654,6 @@
     "src/trace_processor/event_tracker_unittest.cc",
     "src/trace_processor/experimental_counter_dur_generator_unittest.cc",
     "src/trace_processor/forwarding_trace_parser_unittest.cc",
-    "src/trace_processor/ftrace_utils_unittest.cc",
     "src/trace_processor/heap_profile_tracker_unittest.cc",
     "src/trace_processor/importers/fuchsia/fuchsia_trace_utils_unittest.cc",
     "src/trace_processor/importers/proto/args_table_utils_unittest.cc",
@@ -7541,6 +7548,7 @@
     ":perfetto_src_trace_processor_tables_unittests",
     ":perfetto_src_trace_processor_track_event_descriptor",
     ":perfetto_src_trace_processor_types_types",
+    ":perfetto_src_trace_processor_types_unittests",
     ":perfetto_src_trace_processor_unittests",
     ":perfetto_src_traced_probes_android_log_android_log",
     ":perfetto_src_traced_probes_android_log_unittests",
diff --git a/BUILD b/BUILD
index 9bb8c4a..23c24a6 100644
--- a/BUILD
+++ b/BUILD
@@ -839,6 +839,8 @@
     srcs = [
         "src/trace_processor/types/gfp_flags.cc",
         "src/trace_processor/types/gfp_flags.h",
+        "src/trace_processor/types/task_state.cc",
+        "src/trace_processor/types/task_state.h",
         "src/trace_processor/types/variadic.cc",
         "src/trace_processor/types/variadic.h",
     ],
@@ -891,7 +893,6 @@
     srcs = [
         "src/trace_processor/additional_modules.cc",
         "src/trace_processor/additional_modules.h",
-        "src/trace_processor/ftrace_utils.cc",
         "src/trace_processor/importers/ftrace/binder_tracker.cc",
         "src/trace_processor/importers/ftrace/binder_tracker.h",
         "src/trace_processor/importers/ftrace/ftrace_descriptors.cc",
@@ -976,7 +977,6 @@
         "src/trace_processor/event_tracker.h",
         "src/trace_processor/forwarding_trace_parser.cc",
         "src/trace_processor/forwarding_trace_parser.h",
-        "src/trace_processor/ftrace_utils.h",
         "src/trace_processor/global_args_tracker.cc",
         "src/trace_processor/global_args_tracker.h",
         "src/trace_processor/heap_profile_tracker.cc",
diff --git a/src/trace_processor/BUILD.gn b/src/trace_processor/BUILD.gn
index 6138ab6..b69977a 100644
--- a/src/trace_processor/BUILD.gn
+++ b/src/trace_processor/BUILD.gn
@@ -91,7 +91,6 @@
     "event_tracker.h",
     "forwarding_trace_parser.cc",
     "forwarding_trace_parser.h",
-    "ftrace_utils.h",
     "global_args_tracker.cc",
     "global_args_tracker.h",
     "heap_profile_tracker.cc",
@@ -193,7 +192,6 @@
   sources = [
     "additional_modules.cc",
     "additional_modules.h",
-    "ftrace_utils.cc",
     "importers/ftrace/binder_tracker.cc",
     "importers/ftrace/binder_tracker.h",
     "importers/ftrace/ftrace_descriptors.cc",
@@ -371,7 +369,6 @@
     "clock_tracker_unittest.cc",
     "event_tracker_unittest.cc",
     "forwarding_trace_parser_unittest.cc",
-    "ftrace_utils_unittest.cc",
     "heap_profile_tracker_unittest.cc",
     "importers/fuchsia/fuchsia_trace_utils_unittest.cc",
     "importers/proto/args_table_utils_unittest.cc",
@@ -410,6 +407,7 @@
     "db:unittests",
     "storage",
     "tables:unittests",
+    "types:unittests",
   ]
 
   if (enable_perfetto_trace_processor_sqlite) {
diff --git a/src/trace_processor/importers/ftrace/sched_event_tracker.cc b/src/trace_processor/importers/ftrace/sched_event_tracker.cc
index 9d0ff5c..30bf095 100644
--- a/src/trace_processor/importers/ftrace/sched_event_tracker.cc
+++ b/src/trace_processor/importers/ftrace/sched_event_tracker.cc
@@ -21,11 +21,11 @@
 #include "perfetto/ext/base/utils.h"
 #include "src/trace_processor/args_tracker.h"
 #include "src/trace_processor/event_tracker.h"
-#include "src/trace_processor/ftrace_utils.h"
 #include "src/trace_processor/importers/ftrace/ftrace_descriptors.h"
 #include "src/trace_processor/process_tracker.h"
 #include "src/trace_processor/storage/stats.h"
 #include "src/trace_processor/trace_processor_context.h"
+#include "src/trace_processor/types/task_state.h"
 #include "src/trace_processor/types/variadic.h"
 
 #include "protos/perfetto/trace/ftrace/ftrace_event.pbzero.h"
diff --git a/src/trace_processor/importers/fuchsia/fuchsia_trace_tokenizer.cc b/src/trace_processor/importers/fuchsia/fuchsia_trace_tokenizer.cc
index 9720b6c..4a37fff 100644
--- a/src/trace_processor/importers/fuchsia/fuchsia_trace_tokenizer.cc
+++ b/src/trace_processor/importers/fuchsia/fuchsia_trace_tokenizer.cc
@@ -21,12 +21,12 @@
 
 #include "perfetto/base/logging.h"
 #include "perfetto/ext/base/string_view.h"
-#include "src/trace_processor/ftrace_utils.h"
 #include "src/trace_processor/importers/fuchsia/fuchsia_record.h"
 #include "src/trace_processor/process_tracker.h"
 #include "src/trace_processor/slice_tracker.h"
 #include "src/trace_processor/trace_processor_context.h"
 #include "src/trace_processor/trace_sorter.h"
+#include "src/trace_processor/types/task_state.h"
 
 namespace perfetto {
 namespace trace_processor {
diff --git a/src/trace_processor/importers/systrace/systrace_line_parser.cc b/src/trace_processor/importers/systrace/systrace_line_parser.cc
index be456a6..7f863f1 100644
--- a/src/trace_processor/importers/systrace/systrace_line_parser.cc
+++ b/src/trace_processor/importers/systrace/systrace_line_parser.cc
@@ -20,12 +20,12 @@
 #include "perfetto/ext/base/string_utils.h"
 #include "src/trace_processor/args_tracker.h"
 #include "src/trace_processor/event_tracker.h"
-#include "src/trace_processor/ftrace_utils.h"
 #include "src/trace_processor/importers/ftrace/sched_event_tracker.h"
 #include "src/trace_processor/importers/systrace/systrace_parser.h"
 #include "src/trace_processor/process_tracker.h"
 #include "src/trace_processor/slice_tracker.h"
 #include "src/trace_processor/track_tracker.h"
+#include "src/trace_processor/types/task_state.h"
 
 #include <inttypes.h>
 #include <cctype>
diff --git a/src/trace_processor/sqlite_raw_table.cc b/src/trace_processor/sqlite_raw_table.cc
index 75b4508..f35420a 100644
--- a/src/trace_processor/sqlite_raw_table.cc
+++ b/src/trace_processor/sqlite_raw_table.cc
@@ -20,10 +20,10 @@
 
 #include "perfetto/base/compiler.h"
 #include "perfetto/ext/base/string_utils.h"
-#include "src/trace_processor/ftrace_utils.h"
 #include "src/trace_processor/importers/ftrace/ftrace_descriptors.h"
 #include "src/trace_processor/sqlite/sqlite_utils.h"
 #include "src/trace_processor/types/gfp_flags.h"
+#include "src/trace_processor/types/task_state.h"
 #include "src/trace_processor/types/variadic.h"
 
 #include "protos/perfetto/trace/ftrace/binder.pbzero.h"
diff --git a/src/trace_processor/types/BUILD.gn b/src/trace_processor/types/BUILD.gn
index b86ba23..e67df83 100644
--- a/src/trace_processor/types/BUILD.gn
+++ b/src/trace_processor/types/BUILD.gn
@@ -16,6 +16,8 @@
   sources = [
     "gfp_flags.cc",
     "gfp_flags.h",
+    "task_state.cc",
+    "task_state.h",
     "variadic.cc",
     "variadic.h",
   ]
@@ -25,3 +27,13 @@
     "../containers",
   ]
 }
+
+source_set("unittests") {
+  testonly = true
+  sources = [ "task_state_unittests.cc" ]
+  deps = [
+    ":types",
+    "../../../gn:default_deps",
+    "../../../gn:gtest_and_gmock",
+  ]
+}
diff --git a/src/trace_processor/ftrace_utils.cc b/src/trace_processor/types/task_state.cc
similarity index 98%
rename from src/trace_processor/ftrace_utils.cc
rename to src/trace_processor/types/task_state.cc
index b24a991..758ec0b 100644
--- a/src/trace_processor/ftrace_utils.cc
+++ b/src/trace_processor/types/task_state.cc
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "src/trace_processor/ftrace_utils.h"
+#include "src/trace_processor/types/task_state.h"
 
 #include <stdint.h>
 #include <algorithm>
diff --git a/src/trace_processor/ftrace_utils.h b/src/trace_processor/types/task_state.h
similarity index 94%
rename from src/trace_processor/ftrace_utils.h
rename to src/trace_processor/types/task_state.h
index 4a8eec9..0b79277 100644
--- a/src/trace_processor/ftrace_utils.h
+++ b/src/trace_processor/types/task_state.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef SRC_TRACE_PROCESSOR_FTRACE_UTILS_H_
-#define SRC_TRACE_PROCESSOR_FTRACE_UTILS_H_
+#ifndef SRC_TRACE_PROCESSOR_TYPES_TASK_STATE_H_
+#define SRC_TRACE_PROCESSOR_TYPES_TASK_STATE_H_
 
 #include <stddef.h>
 #include <array>
@@ -98,4 +98,4 @@
 }  // namespace trace_processor
 }  // namespace perfetto
 
-#endif  // SRC_TRACE_PROCESSOR_FTRACE_UTILS_H_
+#endif  // SRC_TRACE_PROCESSOR_TYPES_TASK_STATE_H_
diff --git a/src/trace_processor/ftrace_utils_unittest.cc b/src/trace_processor/types/task_state_unittests.cc
similarity index 96%
rename from src/trace_processor/ftrace_utils_unittest.cc
rename to src/trace_processor/types/task_state_unittests.cc
index 3675fb2..a6037ac 100644
--- a/src/trace_processor/ftrace_utils_unittest.cc
+++ b/src/trace_processor/types/task_state_unittests.cc
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "src/trace_processor/ftrace_utils.h"
+#include "src/trace_processor/types/task_state.h"
 
 #include "test/gtest_and_gmock.h"