Added timestamp to torq host file names

Added the current timestamp to the name of the host file to prevent
file overwriting.

Test: atest command_executor_unit_test
Fixes: 374306334
Change-Id: I2c411ad33560b63aed5d85c9840619453a47c046
diff --git a/torq/command_executor.py b/torq/command_executor.py
index 2a374f9..361ad63 100644
--- a/torq/command_executor.py
+++ b/torq/command_executor.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 #
 
+import datetime
 import time
 from abc import ABC, abstractmethod
 from config_builder import PREDEFINED_PERFETTO_CONFIGS, build_custom_config
@@ -60,11 +61,12 @@
       return error
     host_file = None
     for run in range(1, command.runs + 1):
+      timestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
       if command.profiler == "perfetto":
-        host_file = f"{command.out_dir}/trace-{run}.perfetto-trace"
+        host_file = f"{command.out_dir}/trace-{timestamp}.perfetto-trace"
       else:
-        host_file = f"{command.out_dir}/perf-{run}.data"
-      error = self.prepare_device_for_run(command, device, run)
+        host_file = f"{command.out_dir}/perf-{timestamp}.data"
+      error = self.prepare_device_for_run(command, device)
       if error is not None:
         return error
       error = self.execute_run(command, device, config, run)
@@ -92,7 +94,7 @@
   def prepare_device(self, command, device, config):
     return None
 
-  def prepare_device_for_run(self, command, device, run):
+  def prepare_device_for_run(self, command, device):
     if command.profiler == "perfetto":
       device.remove_file(PERFETTO_TRACE_FILE)
     else:
@@ -126,8 +128,8 @@
 
 class UserSwitchCommandExecutor(ProfilerCommandExecutor):
 
-  def prepare_device_for_run(self, command, device, run):
-    super().prepare_device_for_run(command, device, run)
+  def prepare_device_for_run(self, command, device):
+    super().prepare_device_for_run(command, device)
     current_user = device.get_current_user()
     if command.from_user != current_user:
       print("Switching from the current user, %s, to the from-user, %s."
@@ -151,7 +153,7 @@
   def prepare_device(self, command, device, config):
     device.write_to_file("/data/misc/perfetto-configs/boottrace.pbtxt", config)
 
-  def prepare_device_for_run(self, command, device, run):
+  def prepare_device_for_run(self, command, device):
     device.remove_file(PERFETTO_BOOT_TRACE_FILE)
     device.set_prop("persist.debug.perfetto.boottrace", "1")