mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-23 03:31:16 +00:00
* GSWDebug.h: remove unused functions * GSWApplication.h/.m:Added: GSWDebuggingStatus category +isStatusDebuggingEnabled +setStatusDebuggingEnabled: +debugSetConfigFilePath +setDebugSetConfigFilePath: * GSWApplication.h/.m: replaced GSWDebugStdLog by [GSWApp statusDebug...] replaced executeWithClasses: with executeWithClassArray: corrections for different warnings change in GSWApplicationDebugSetChange() to use GSWDebugSetConfigFi lePath option * GSWConfig.h: added GSWOPTVALUE_StatusDebuggingEnabled * GSWConstants.h/.m: added GSWOPT_StatusDebuggingEnabled added GSWOPT_DebugSetConfigFilePath * INSTALL: reflect changes of adaptors,... * GSWUtil.h/.m: corrections for different warnings removed MD5HexDigest() * GSWCheckBoxListm: replaced LOGAssertGood by GSWLogAssertGood * GSWRadioButtonList.m: replaced LOGAssertGood by GSWLogAssertGood * GSWDefaultAdaptorThread.m: replaced GSWLogCStdOut by +statusLogWithFormat : corrections for different warnings * GSWDefaultAdaptor.m: replaced GSWLogCStdOut by +statusLogWithFormat: * GSWSessionTimeOutManager.m: replaced GSWLogCStdOut by +statusLogWithForma t: * GSWKeyValueAssociation.m: replaced LOGAssertGood by GSWLogAssertGood * GSWHTMLStaticElement.m: corrections for different warnings * GSWConstantValueAssociation.m: replaced LOGAssertGood by GSWLogAssertGood * GSWHTMLDynamicElement.m: corrections for different warnings * GSWStatsPage.m: corrections for different warnings * GSWExceptionPage.m: removed GSWLogCStdOut calls * GSWSession.m: replaced GSWLogCStdOut by +statusLogWithFormat: replaced LOGAssertGood by GSWLogAssertGood * GSWAssociation.m: replaced LOGAssertGood by GSWLogAssertGood * GSWComponent.m: replaced LOGAssertGood by GSWLogAssertGood * GSWContext.m: replaced LOGAssertGood by GSWLogAssertGood * GSWRequest.m: replaced LOGAssertGood by GSWLogAssertGood * GSWResponse.m: replaced LOGAssertGood by GSWLogAssertGood * GSWSessionStore.m: replaced LOGAssertGood by GSWLogAssertGood * Adator GSWAppRequest.c: test on instance in GSWAppRequest_SendAppRequestT oApp * Adator GSWLoadBalancing.c: added debug messages * Adaptor GSWHTTPRequest.c: corrected bug in GSWHTTPRequest_SendRequest * Adaptor: GSWAppConnectSocket.c: added debug messages * GSWeb.framework/Makefile.preamble: removed -lNGReflection git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@6345 72102866-910b-0410-8b05-ffd578937521
134 lines
4.1 KiB
Objective-C
134 lines
4.1 KiB
Objective-C
/* GSWStatsPage.m - GSWeb: Class GSWStatsPage
|
|
Copyright (C) 1999 Free Software Foundation, Inc.
|
|
|
|
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
|
Date: Apr 1999
|
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Library General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Library General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
License along with this library; if not, write to the Free
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
#include <gsweb/GSWeb.framework/GSWeb.h>
|
|
#include "GSWStatsPage.h"
|
|
|
|
//===================================================================================
|
|
@implementation GSWStatsPage
|
|
-(id)submit
|
|
{
|
|
GSWStatisticsStore* _statisticsStore = [[self application] statisticsStore];
|
|
if (_statisticsStore)
|
|
{
|
|
[_statisticsStore validateLogin:password];
|
|
};
|
|
return self;
|
|
};
|
|
|
|
-(id)host
|
|
{
|
|
return [[NSHost currentHost] name];
|
|
}
|
|
|
|
-(id)instance
|
|
{
|
|
id _instance=nil;
|
|
NSArray* _commandLineArguments = [[NSProcessInfo processInfo] arguments];
|
|
unsigned int i=0;
|
|
i = [_commandLineArguments indexOfObject:@"-n"];
|
|
if (i!=NSNotFound && ([_commandLineArguments count] > i + 1))
|
|
_instance=[_commandLineArguments objectAtIndex:i+1];
|
|
return _instance;
|
|
};
|
|
|
|
-(NSNumber*)_maxServedForDictionary:(NSDictionary*)aDictionary
|
|
{
|
|
int _maxServedCount = 0;
|
|
int _tmpCount=0;
|
|
NSDictionary* _page = nil;
|
|
NSEnumerator* _enum = [aDictionary objectEnumerator];
|
|
while ((_page = [_enum nextObject]))
|
|
{
|
|
_tmpCount = [[_page objectForKey:@"Served"] intValue];
|
|
_maxServedCount = max(_maxServedCount,_tmpCount);
|
|
};
|
|
return [NSNumber numberWithInt:_maxServedCount];
|
|
};
|
|
|
|
-(id)_initIvars
|
|
{
|
|
id currentCount=nil;
|
|
statsDict = [[self application] statistics];
|
|
pagesDict = [statsDict objectForKey:@"Pages"];
|
|
directActionsDict = [statsDict objectForKey:@"DirectActions"];
|
|
detailsDict = [statsDict objectForKey:@"Details"];
|
|
transactions = [statsDict objectForKey:@"Transactions"];
|
|
memoryDict = [statsDict objectForKey:@"Memory"];
|
|
sessionsDict = [[[NSMutableDictionary alloc] initWithDictionary:
|
|
[statsDict objectForKey:@"Sessions"]]
|
|
autorelease];
|
|
sessionMemoryDict = [sessionsDict objectForKey:@"Avg. Memory Per Session"];
|
|
[sessionsDict removeObjectForKey:@"Avg. Memory Per Session"];
|
|
|
|
sessionStats = [sessionsDict objectForKey:@"Last Session's Statistics"];
|
|
[sessionsDict removeObjectForKey:@"Last Session's Statistics"];
|
|
|
|
maxSessionsDate = [sessionsDict objectForKey:@"Peak Active Sessions Date"];
|
|
[sessionsDict removeObjectForKey:@"Peak Active Sessions Date"];
|
|
|
|
maxPageCount = 0;
|
|
maxActionCount = 0;
|
|
|
|
maxPageCount = [self _maxServedForDictionary:pagesDict];
|
|
maxActionCount = [self _maxServedForDictionary:directActionsDict];
|
|
return nil; //??? //TODO
|
|
};
|
|
|
|
-(void)appendToResponse:(GSWResponse*)aResponse
|
|
inContext:(GSWContext*)aContext
|
|
{
|
|
// ** This should probably be somewhere else.
|
|
[self _initIvars];
|
|
[super appendToResponse:aResponse
|
|
inContext:aContext];
|
|
};
|
|
|
|
|
|
-(void)setDetailPercent:(NSNumber*)aValue
|
|
{
|
|
}
|
|
|
|
-(NSNumber*)detailPercent
|
|
{
|
|
int _detailPercent=0;
|
|
id aTransactionsCount = [transactions objectForKey:@"Transactions"];
|
|
int aDetailCount = [[self detailCount] intValue];
|
|
if (aTransactionsCount > 0)
|
|
_detailPercent=(aDetailCount / [aTransactionsCount intValue]) * 100;
|
|
return [NSNumber numberWithInt:_detailPercent];
|
|
};
|
|
|
|
-(id)runningTime
|
|
{
|
|
NSTimeInterval aRunningTime = (-1.0 * [[statsDict objectForKey:@"StartedAt"] timeIntervalSinceNow]);
|
|
NSString* aRunningTimeString = [GSWStatisticsStore timeIntervalDescription:aRunningTime];
|
|
return aRunningTimeString;
|
|
}
|
|
|
|
-(id)detailCount
|
|
{
|
|
return [detailsDict objectForKey:tmpKey];
|
|
}
|
|
|
|
|
|
@end
|