Add option for tracing AIDL calls.

This allows generating AIDL code that traces to the newly
introduced ATRACE_TAG_AIDL, for both c++ and Java targets.

The "::client" traces wrap the complete call, from entering
the proxy right until returning the result. As such, this
tag can be used to measure the complete duration of the IPC
call.

The "::server" traces wrap the actual execution of the
method on the server side, so it can be used to determine
the actual time the server took to complete the work.

Subtracting the "::server" slice from the corresponding
"::client" slice allows determining the overhead binder
itself introduced.

This is similar to how HIDL calls are traced.

Bug: 74416314
Test: aidl_unittest passed (incl new tests),
      verified atrace outpout
Change-Id: Id9a0207d53ebbdb6a21d8d96f56b8eee116bd477
Merged-In: Id9a0207d53ebbdb6a21d8d96f56b8eee116bd477
diff --git a/options.h b/options.h
index 6b3ac26..11f3525 100644
--- a/options.h
+++ b/options.h
@@ -54,6 +54,7 @@
   std::string dep_file_name_;
   bool auto_dep_file_{false};
   bool dep_file_ninja_{false};
+  bool gen_traces_{false};
   std::vector<std::string> files_to_preprocess_;
 
   // The following are for testability, but cannot be influenced on the command line.
@@ -67,6 +68,7 @@
   JavaOptions() = default;
 
   FRIEND_TEST(EndToEndTest, IExampleInterface);
+  FRIEND_TEST(EndToEndTest, IExampleInterface_WithTrace);
   FRIEND_TEST(EndToEndTest, IExampleInterface_Outlining);
   FRIEND_TEST(AidlTest, FailOnParcelable);
   FRIEND_TEST(AidlTest, WritePreprocessedFile);
@@ -94,6 +96,7 @@
   std::vector<std::string> ImportPaths() const { return import_paths_; }
   std::string DependencyFilePath() const { return dep_file_name_; }
   bool DependencyFileNinja() const { return dep_file_ninja_; }
+  bool ShouldGenTraces() const { return gen_traces_; }
 
  private:
   CppOptions() = default;
@@ -103,6 +106,7 @@
   std::string output_header_dir_;
   std::string output_file_name_;
   std::string dep_file_name_;
+  bool gen_traces_{false};
   bool dep_file_ninja_{false};
 
   FRIEND_TEST(CppOptionsTests, ParsesCompileCpp);