|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patch php_fpm_log_utime_stime.patch for FPM related Bug #62951Patch version 2012-08-27 14:13 UTC Return to Bug #62951 | Download this patchThis patch is obsolete Obsoleted by patches: Patch Revisions:Developer: rainer-phpbugs@7val.com
--- php-5.3.16/sapi/fpm/fpm/fpm_scoreboard.h 2012-08-15 19:05:42.000000000 +0200
+++ ../php-5.3.16/sapi/fpm/fpm/fpm_scoreboard.h 2012-08-27 14:25:58.208601367 +0200
@@ -4,14 +4,17 @@
#ifndef FPM_SCOREBOARD_H
#define FPM_SCOREBOARD_H 1
#include <sys/time.h>
#ifdef HAVE_TIMES
#include <sys/times.h>
+#ifdef HAVE_GETRUSAGE
+#include <sys/resource.h>
+#endif
#endif
#include "fpm_request.h"
#include "fpm_worker_pool.h"
#include "fpm_atomic.h"
#define FPM_SCOREBOARD_ACTION_SET 0
@@ -35,16 +38,24 @@
char query_string[512];
char request_method[16];
size_t content_length; /* used with POST only */
char script_filename[256];
char auth_user[32];
#ifdef HAVE_TIMES
struct tms cpu_accepted;
+#ifdef HAVE_GETRUSAGE
+ struct rusage rus_accepted;
+ struct rusage ruc_accepted;
+#endif
struct timeval cpu_duration;
struct tms last_request_cpu;
+#ifdef HAVE_GETRUSAGE
+ struct rusage last_request_rus;
+ struct rusage last_request_ruc;
+#endif
struct timeval last_request_cpu_duration;
#endif
size_t memory;
};
struct fpm_scoreboard_s {
union {
--- php-5.3.16/sapi/fpm/fpm/fpm_request.c 2012-08-15 19:05:42.000000000 +0200
+++ ../php-5.3.16/sapi/fpm/fpm/fpm_request.c 2012-08-27 14:25:58.204600772 +0200
@@ -82,14 +82,22 @@
proc->request_stage = FPM_REQUEST_READING_HEADERS;
proc->tv = now;
proc->accepted = now;
proc->accepted_epoch = now_epoch;
#ifdef HAVE_TIMES
proc->cpu_accepted = cpu;
+#ifdef HAVE_GETRUSAGE
+ if (getrusage(RUSAGE_SELF, &proc->rus_accepted)!=0) {
+ bzero(&proc->rus_accepted, sizeof(proc->rus_accepted));
+ };
+ if (getrusage(RUSAGE_CHILDREN, &proc->ruc_accepted)!=0) {
+ bzero(&proc->ruc_accepted, sizeof(proc->ruc_accepted));
+ };
+#endif
#endif
proc->requests++;
proc->request_uri[0] = '\0';
proc->request_method[0] = '\0';
proc->script_filename[0] = '\0';
proc->query_string[0] = '\0';
proc->query_string[0] = '\0';
@@ -196,14 +204,22 @@
timersub(&now, &proc->accepted, &proc->duration);
#ifdef HAVE_TIMES
timersub(&proc->tv, &proc->accepted, &proc->cpu_duration);
proc->last_request_cpu.tms_utime = cpu.tms_utime - proc->cpu_accepted.tms_utime;
proc->last_request_cpu.tms_stime = cpu.tms_stime - proc->cpu_accepted.tms_stime;
proc->last_request_cpu.tms_cutime = cpu.tms_cutime - proc->cpu_accepted.tms_cutime;
proc->last_request_cpu.tms_cstime = cpu.tms_cstime - proc->cpu_accepted.tms_cstime;
+#ifdef HAVE_GETRUSAGE
+ if (getrusage(RUSAGE_SELF, &(proc->last_request_rus))!=0){
+ bzero(&proc->last_request_rus, sizeof(proc->last_request_rus));
+ }
+ if (getrusage(RUSAGE_CHILDREN, &(proc->last_request_ruc))!=0){
+ bzero(&proc->last_request_ruc, sizeof(proc->last_request_ruc));
+ }
+#endif
#endif
proc->memory = memory;
fpm_scoreboard_proc_release(proc);
}
/* }}} */
void fpm_request_finished() /* {{{ */
|
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 17:00:02 2025 UTC |