2222
2323int main (int argc, char *argv[])
2424{
25- tsp::Semaphore_File *sf = new tsp::Semaphore_File ();
26- // Parse args: only take the ones we use for now
25+ tsp::Status_Manager stat;
2726 int c;
2827 uint32_t nslots = 1 ;
2928 bool disappear_output = false ;
3029 bool do_fork = true ;
3130 bool separate_stderr = false ;
3231
33- if (argc == 1 )
34- {
35- // List all jobs we're aware of
36- std::cout << " ID State Output E-Level Time Command" << std::endl;
37- for (const auto &entry : std::filesystem::directory_iterator (get_tmp ()))
38- {
39- if (entry.path ().filename ().string ().find (STATUS_FILE_TEMPLATE) != std::string::npos)
40- {
41- std::ifstream stat_file (entry.path ());
42-
43- }
44- }
45- }
46-
32+ // Parse args: only take the ones we use for now
4733 while ((c = getopt (argc, argv, " +nfN:E" )) != -1 )
4834 {
4935 switch (c)
@@ -64,6 +50,9 @@ int main(int argc, char *argv[])
6450 }
6551 }
6652
53+ tsp::Run_cmd cmd (argv, optind, argc);
54+ stat.add_cmd (cmd,nslots);
55+
6756 if (do_fork)
6857 {
6958 pid_t main_fork_pid;
@@ -83,8 +72,6 @@ int main(int argc, char *argv[])
8372 std::chrono::duration sleep (std::chrono::milliseconds (JITTER_MS + jitter.get ()));
8473 std::this_thread::sleep_for (sleep);
8574
86- tsp::Run_cmd cmd (argv, optind, argc);
87- tsp::Status_Manager stat (cmd, nslots);
8875 tsp::Tsp_Proc me (nslots);
8976
9077 cpu_set_t mask;
@@ -96,7 +83,7 @@ int main(int argc, char *argv[])
9683 me.refresh_allowed_cores ();
9784 }
9885 stat.job_start ();
99- delete sf;
86+ // delete sf;
10087 for (uint32_t i = 0 ; i < nslots; i++)
10188 {
10289 CPU_SET (me.allowed_cores [i], &mask);
0 commit comments