about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/DS.pm94
1 files changed, 0 insertions, 94 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index f181eee0..7bd5d42b 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -13,8 +13,6 @@ use bytes;
 use POSIX ();
 use Time::HiRes ();
 
-my $opt_bsd_resource = eval "use BSD::Resource; 1;";
-
 use vars qw{$VERSION};
 $VERSION = "1.61";
 
@@ -63,8 +61,6 @@ our (
      %PLCMap,                    # fd (num) -> PostLoopCallback (per-object)
 
      $LoopTimeout,               # timeout of event loop in milliseconds
-     $DoProfile,                 # if on, enable profiling
-     %Profiling,                 # what => [ utime, stime, calls ]
      $DoneInit,                  # if we've done the one-time module init yet
      @Timers,                    # timers
      );
@@ -87,8 +83,6 @@ sub Reset {
     @ToClose = ();
     %OtherFds = ();
     $LoopTimeout = -1;  # no timeout by default
-    $DoProfile = 0;
-    %Profiling = ();
     @Timers = ();
 
     $PostLoopCallback = undef;
@@ -122,40 +116,6 @@ sub WatchedSockets {
 }
 *watched_sockets = *WatchedSockets;
 
-=head2 C<< CLASS->EnableProfiling() >>
-
-Turns profiling on, clearing current profiling data.
-
-=cut
-sub EnableProfiling {
-    if ($opt_bsd_resource) {
-        %Profiling = ();
-        $DoProfile = 1;
-        return 1;
-    }
-    return 0;
-}
-
-=head2 C<< CLASS->DisableProfiling() >>
-
-Turns off profiling, but retains data up to this point
-
-=cut
-sub DisableProfiling {
-    $DoProfile = 0;
-}
-
-=head2 C<< CLASS->ProfilingData() >>
-
-Returns reference to a hash of data in format:
-
-  ITEM => [ utime, stime, #calls ]
-
-=cut
-sub ProfilingData {
-    return \%Profiling;
-}
-
 =head2 C<< CLASS->ToClose() >>
 
 Return the list of sockets that are awaiting close() at the end of the
@@ -306,28 +266,6 @@ sub FirstTimeEventLoop {
     }
 }
 
-## profiling-related data/functions
-our ($Prof_utime0, $Prof_stime0);
-sub _pre_profile {
-    ($Prof_utime0, $Prof_stime0) = getrusage();
-}
-
-sub _post_profile {
-    # get post information
-    my ($autime, $astime) = getrusage();
-
-    # calculate differences
-    my $utime = $autime - $Prof_utime0;
-    my $stime = $astime - $Prof_stime0;
-
-    foreach my $k (@_) {
-        $Profiling{$k} ||= [ 0.0, 0.0, 0 ];
-        $Profiling{$k}->[0] += $utime;
-        $Profiling{$k}->[1] += $stime;
-        $Profiling{$k}->[2]++;
-    }
-}
-
 # runs timers and returns milliseconds for next one, or next event loop
 sub RunTimers {
     return $LoopTimeout unless @Timers;
@@ -404,38 +342,6 @@ sub EpollEventLoop {
             DebugLevel >= 1 && $class->DebugMsg("Event: fd=%d (%s), state=%d \@ %s\n",
                                                 $ev->[0], ref($pob), $ev->[1], time);
 
-            if ($DoProfile) {
-                my $class = ref $pob;
-
-                # call profiling action on things that need to be done
-                if ($state & EPOLLIN && ! $pob->{closed}) {
-                    _pre_profile();
-                    $pob->event_read;
-                    _post_profile("$class-read");
-                }
-
-                if ($state & EPOLLOUT && ! $pob->{closed}) {
-                    _pre_profile();
-                    $pob->event_write;
-                    _post_profile("$class-write");
-                }
-
-                if ($state & (EPOLLERR|EPOLLHUP)) {
-                    if ($state & EPOLLERR && ! $pob->{closed}) {
-                        _pre_profile();
-                        $pob->event_err;
-                        _post_profile("$class-err");
-                    }
-                    if ($state & EPOLLHUP && ! $pob->{closed}) {
-                        _pre_profile();
-                        $pob->event_hup;
-                        _post_profile("$class-hup");
-                    }
-                }
-
-                next;
-            }
-
             # standard non-profiling codepat
             $pob->event_read   if $state & EPOLLIN && ! $pob->{closed};
             $pob->event_write  if $state & EPOLLOUT && ! $pob->{closed};