* [PATCH 4/4] DS: drop profiling support
2019-05-05 0:52 6% [PATCH 0/4] bundle Danga::Socket and Sys::Syscall Eric Wong
2019-05-08 19:18 7% ` [PATCH 0/4] Danga::Socket bundling cleanups Eric Wong
@ 2019-05-05 0:52 5% ` Eric Wong
1 sibling, 0 replies; 3+ results
From: Eric Wong @ 2019-05-05 0:52 UTC (permalink / raw)
To: meta
There's other ways to profile and we don't need to add runtime
branches to do this.
---
lib/PublicInbox/DS.pm | 94 -------------------------------------------
1 file changed, 94 deletions(-)
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index f181eee..7bd5d42 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};
--
EW
^ permalink raw reply related [relevance 5%]
* [PATCH 0/4] bundle Danga::Socket and Sys::Syscall
@ 2019-05-05 0:52 6% Eric Wong
2019-05-08 19:18 7% ` [PATCH 0/4] Danga::Socket bundling cleanups Eric Wong
2019-05-05 0:52 5% ` [PATCH 4/4] DS: drop profiling support Eric Wong
0 siblings, 2 replies; 3+ results
From: Eric Wong @ 2019-05-05 0:52 UTC (permalink / raw)
To: meta
This is probably our rarest and most esoteric dependencies
at the moment, so bundle them, add some features, and drop
unused ones. It'll also give me an excuse to play with more
recent Linux kernel developments :> More on this in [1/4]
Eric Wong (4):
bundle Danga::Socket and Sys::Syscall
listener: use EPOLLEXCLUSIVE for listen sockets
DS: remove unused fields and functions
DS: drop profiling support
INSTALL | 4 -
MANIFEST | 2 +
TODO | 5 +-
lib/PublicInbox/DS.pm | 1051 +++++++++++++++++++++++++++++
lib/PublicInbox/Daemon.pm | 8 +-
lib/PublicInbox/EvCleanup.pm | 12 +-
lib/PublicInbox/GitHTTPBackend.pm | 2 +-
lib/PublicInbox/HTTP.pm | 12 +-
lib/PublicInbox/HTTPD/Async.pm | 4 +-
lib/PublicInbox/Listener.pm | 4 +-
lib/PublicInbox/NNTP.pm | 6 +-
lib/PublicInbox/ParentPipe.pm | 2 +-
lib/PublicInbox/Qspawn.pm | 4 +-
lib/PublicInbox/Syscall.pm | 329 +++++++++
t/git-http-backend.t | 2 +-
t/httpd-corner.t | 2 +-
t/httpd-unix.t | 2 +-
t/httpd.t | 2 +-
t/nntp.t | 2 +-
t/nntpd.t | 2 +-
t/v2mirror.t | 2 +-
t/v2writable.t | 4 +-
22 files changed, 1419 insertions(+), 44 deletions(-)
create mode 100644 lib/PublicInbox/DS.pm
create mode 100644 lib/PublicInbox/Syscall.pm
--
EW
^ permalink raw reply [relevance 6%]
* [PATCH 0/4] Danga::Socket bundling cleanups
2019-05-05 0:52 6% [PATCH 0/4] bundle Danga::Socket and Sys::Syscall Eric Wong
@ 2019-05-08 19:18 7% ` Eric Wong
2019-05-05 0:52 5% ` [PATCH 4/4] DS: drop profiling support Eric Wong
1 sibling, 0 replies; 3+ results
From: Eric Wong @ 2019-05-08 19:18 UTC (permalink / raw)
To: meta
Dropping some unused stuff, and a bugfix for an error path we never hit.
(all bugfixes are queued for the future maintainer via
bug-Danga-Socket@rt.cpan.org )
Eric Wong (4):
build: do not manify DS and Syscall pods
syscall: drop readahead wrapper
DS: drop unused "_undef" sub
DS: epoll: fix misordered EPOLL_CTL_DEL call
Makefile.PL | 10 ++++++++++
lib/PublicInbox/DS.pm | 9 +--------
lib/PublicInbox/Syscall.pm | 14 --------------
3 files changed, 11 insertions(+), 22 deletions(-)
The "danga-bundle" is up to 10 patches, now; and dogfooded
on public-inbox.org for several days without problems.
Will merge to "master" soon:
bundle Danga::Socket and Sys::Syscall
listener: use EPOLLEXCLUSIVE for listen sockets
DS: remove unused fields and functions
DS: drop profiling support
DS: workaround IO::Kqueue EINTR (mis-)handling
DS: handle EINTR in IO::Poll path, too
build: do not manify DS and Syscall pods
syscall: drop readahead wrapper
DS: drop unused "_undef" sub
DS: epoll: fix misordered EPOLL_CTL_DEL call
^ permalink raw reply [relevance 7%]
Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-05-05 0:52 6% [PATCH 0/4] bundle Danga::Socket and Sys::Syscall Eric Wong
2019-05-08 19:18 7% ` [PATCH 0/4] Danga::Socket bundling cleanups Eric Wong
2019-05-05 0:52 5% ` [PATCH 4/4] DS: drop profiling support Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).