You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2001/01/22 00:19:03 UTC
cvs commit: modperl-2.0/src/modules/perl modperl_time.h mod_perl.h modperl_apache_xs.c
dougm 01/01/21 15:19:03
Modified: lib/ModPerl Code.pm
src/modules/perl mod_perl.h modperl_apache_xs.c
Added: src/modules/perl modperl_time.h
Log:
add some cpu timing stuff
Revision Changes Path
1.38 +2 -1 modperl-2.0/lib/ModPerl/Code.pm
Index: Code.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- Code.pm 2001/01/20 21:19:08 1.37
+++ Code.pm 2001/01/21 23:19:02 1.38
@@ -326,6 +326,7 @@
's' => 'perl sections',
'h' => 'handlers',
'm' => 'memory allocations',
+ 't' => 'benchmark-ish timings',
'i' => 'interpreter pool management',
'g' => 'Perl runtime interaction',
'f' => 'filters',
@@ -460,7 +461,7 @@
my @g_h_names = map { "modperl_$_" } qw(hooks directives flags trace);
my @h_names = (@c_names, map { "modperl_$_" }
- qw(types apache_includes perl_includes));
+ qw(types time apache_includes perl_includes));
sub h_files { [map { "$_.h" } @h_names, @g_h_names] }
sub clean_files {
1.25 +1 -0 modperl-2.0/src/modules/perl/mod_perl.h
Index: mod_perl.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- mod_perl.h 2001/01/20 21:19:08 1.24
+++ mod_perl.h 2001/01/21 23:19:03 1.25
@@ -12,6 +12,7 @@
#ifdef MP_USE_GTOP
#include "modperl_gtop.h"
#endif
+#include "modperl_time.h"
#include "modperl_types.h"
#include "modperl_util.h"
#include "modperl_config.h"
1.5 +6 -0 modperl-2.0/src/modules/perl/modperl_apache_xs.c
Index: modperl_apache_xs.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_apache_xs.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- modperl_apache_xs.c 2001/01/21 21:22:59 1.4
+++ modperl_apache_xs.c 2001/01/21 23:19:03 1.5
@@ -63,17 +63,23 @@
modperl_request_config_t *rcfg;
apr_size_t bytes = 0;
request_rec *r;
+ dMP_TIMES;
mpxs_usage_1(r, "$r->write(...)");
rcfg = modperl_request_config_get(r);
scfg = modperl_srv_config_get(r->server);
+ MP_START_TIMES();
+
#ifdef MP_USE_AP_RWRITE
mpxs_rwrite_loop(mpxs_ap_rwrite, r);
#else
mpxs_write_loop(modperl_wbucket_write, &rcfg->wbucket);
#endif
+
+ MP_END_TIMES();
+ MP_PRINT_TIMES("r->write");
/* XXX: flush if $| */
1.1 modperl-2.0/src/modules/perl/modperl_time.h
Index: modperl_time.h
===================================================================
#ifndef MODPERL_TIME_H
#define MODPERL_TIME_H
#ifdef MP_TRACE
#define dMP_TIMES \
struct tms start_time; \
struct tms end_time
#else
#define dMP_TIMES dNOOP
#endif
#define MP_START_TIMES() \
MP_TRACE_t_do((void)times(&start_time))
#define MP_END_TIMES() \
MP_TRACE_t_do((void)times(&end_time))
#define MP_PRINT_TIMES(label) \
MP_TRACE_t_do({ \
double utime = \
(double)(end_time.tms_utime - start_time.tms_utime)/HZ; \
double stime = \
(double)(end_time.tms_stime - start_time.tms_stime)/HZ; \
if (utime || stime) { \
MP_TRACE_t(MP_FUNC, "%s %5.2f user %5.2f sys\n", \
label, utime, stime); \
} \
})
#endif /* MODPERL_TIME_H */