From d5a03c0d2514d662a7f4e231b7be992d2bf2de0d Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 18 May 2010 17:57:58 +0000 Subject: [PATCH] Monotone-Parent: 2b073c86000b676cc91d3818d5d6c6db3446f2e2 Monotone-Revision: 6eba62f428795a0fa79c3f6fa089c1f0bdb79224 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-05-18T17:57:58 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ Main/SOGo.m | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b878d416..2c3b5eb61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-05-18 Wolfgang Sourdeau + + * Main/SOGo.m (-dispatchRequest:): send a "SOGoRequestDuration" + header back to the client with the time delta as value when + SOGoDebugRequests is set to YES. + 2010-05-17 Wolfgang Sourdeau * UI/WebServerResources/UIxAttendeesEditor.js diff --git a/Main/SOGo.m b/Main/SOGo.m index 7b175a1d1..c4095e3eb 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -388,7 +388,8 @@ static BOOL debugLeaks; static NSArray *runLoopModes = nil; static BOOL debugOn = NO; WOResponse *resp; - NSDate *startDate, *endDate; + NSDate *startDate; + NSTimeInterval timeDelta; if (debugRequests) { @@ -416,9 +417,12 @@ static BOOL debugLeaks; if (debugRequests) { - endDate = [NSDate date]; - [self logWithFormat: @"request took %f seconds to execute", - [endDate timeIntervalSinceDate: startDate]]; + timeDelta = [[NSDate date] timeIntervalSinceDate: startDate]; + [self logWithFormat: [NSString stringWithFormat: + @"request took %f seconds to execute", + timeDelta]]; + [resp setHeader: [NSString stringWithFormat: @"%f", timeDelta] + forKey: @"SOGoRequestDuration"]; } if (![self isTerminating])