From cce786a3de965085d185274c4e436c608d367f86 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 1 Oct 2024 15:53:13 +0000 Subject: [PATCH 1/2] improve naming --- xprof/xprof.rb.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xprof/xprof.rb.in b/xprof/xprof.rb.in index 0a2ed09a..66396d42 100755 --- a/xprof/xprof.rb.in +++ b/xprof/xprof.rb.in @@ -233,7 +233,7 @@ end # |_) _. ._ ._ o _ ._ # |_) (_| | | | (/_ | # -class Sync_daemon +class SyncDaemon SIGRTMIN = 34 RT_SIGNAL_READY = SIGRTMIN RT_SIGNAL_GLOBAL_BARRIER = SIGRTMIN + 1 @@ -280,13 +280,13 @@ class Sync_daemon end LOGGER.debug { "spawn(#{daemon} #{Process.pid})" } - lazy_exec("Initialize Sync_daemon #{daemon_type}") do + lazy_exec("Initialize SyncDaemon #{daemon_type}") do @pid = spawn("#{daemon} #{Process.pid}") end end def finalize - lazy_exec('Finalize Sync_daemon') do + lazy_exec('Finalize SyncDaemon') do `kill -#{RT_SIGNAL_FINISH} #{@pid}` end end @@ -306,14 +306,14 @@ class Sync_daemon # Context manager, ensure that when the block yield is exited # we always call clean-up the daemon def self.open - yield f = new + yield syncd = new rescue Errno::ENOENT exit(1) ensure # https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/EnsureReturn - if f - f.global_barrier - f.finalize + if syncd + syncd.global_barrier + syncd.finalize end end end @@ -669,7 +669,7 @@ def trace_and_on_node_processing(usr_argv) lm_lttng_kill_sessiond end - Sync_daemon.open do |syncd| + SyncDaemon.open do |syncd| # Load Tracers and APILoaders Lib backends, h = env_tracers From 7a8d2ee8bb4c3eef36cb3fe12fab2402077ba223 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 1 Oct 2024 16:23:12 +0000 Subject: [PATCH 2/2] fix sync_daemon_fs --- xprof/sync_daemon_fs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xprof/sync_daemon_fs b/xprof/sync_daemon_fs index dea845b7..c04c0d10 100755 --- a/xprof/sync_daemon_fs +++ b/xprof/sync_daemon_fs @@ -61,19 +61,19 @@ global_handle = nil parent_pid = nil # Set trap -Signal.trap(Sync_daemon::RT_SIGNAL_GLOBAL_BARRIER) do +Signal.trap(SyncDaemon::RT_SIGNAL_GLOBAL_BARRIER) do global_barrier(global_handle) - Process.kill(Sync_daemon::RT_SIGNAL_READY, parent_pid) + Process.kill(SyncDaemon::RT_SIGNAL_READY, parent_pid) end local_barier_count = 0 -Signal.trap(Sync_daemon::RT_SIGNAL_LOCAL_BARRIER) do +Signal.trap(SyncDaemon::RT_SIGNAL_LOCAL_BARRIER) do local_barier(local_barier_count.to_s) local_barier_count += 1 - Process.kill(Sync_daemon::RT_SIGNAL_READY, parent_pid) + Process.kill(SyncDaemon::RT_SIGNAL_READY, parent_pid) end -Signal.trap(Sync_daemon::RT_SIGNAL_FINISH) do +Signal.trap(SyncDaemon::RT_SIGNAL_FINISH) do # We cannot delete SHARED_LOCAL_FILESYSTEM # Some rank can exit the `global_barier` (hence calling this function) # when others ranks are still in the `local_barrier` @@ -83,12 +83,12 @@ Signal.trap(Sync_daemon::RT_SIGNAL_FINISH) do # is to make all ranks busy_wait in the `global_barrier`. # This will ensure that every-one exited the `local_barrier`. # but given the poor performance of our FS, we will avoid that for now... - Process.kill(Sync_daemon::RT_SIGNAL_READY, parent_pid) + Process.kill(SyncDaemon::RT_SIGNAL_READY, parent_pid) exit end # Init global barrier global_handle = init_global_barrier parent_pid = ARGV[0].to_i -Process.kill(Sync_daemon::RT_SIGNAL_READY, parent_pid) +Process.kill(SyncDaemon::RT_SIGNAL_READY, parent_pid) sleep