mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-11 08:30:42 +00:00
Improve duration/debug logging
This commit is contained in:
parent
085c36c340
commit
46cf998afc
2 changed files with 24 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
|||
2019-07-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* SQLClient.m: Improve logging of cache queries to indicate that
|
||||
the query was from the cache and whether it was a it or a miss.
|
||||
|
||||
2019-07-14 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* SQLClient.h
|
||||
|
|
30
SQLClient.m
30
SQLClient.m
|
@ -3505,6 +3505,7 @@ static int poolConnections = 0;
|
|||
NSMutableDictionary *md;
|
||||
GSCache *c;
|
||||
id toCache;
|
||||
BOOL cacheHit;
|
||||
|
||||
if (rtype == 0) rtype = rClass;
|
||||
if (ltype == 0) ltype = aClass;
|
||||
|
@ -3530,6 +3531,7 @@ static int poolConnections = 0;
|
|||
{
|
||||
CacheQuery *a;
|
||||
|
||||
cacheHit = NO;
|
||||
a = [CacheQuery new];
|
||||
a->query = [stmt copy];
|
||||
a->recordType = rtype;
|
||||
|
@ -3552,17 +3554,10 @@ static int poolConnections = 0;
|
|||
modes: queryModes];
|
||||
}
|
||||
result = [c objectForKey: stmt];
|
||||
_lastOperation = GSTickerTimeNow();
|
||||
if (_duration >= 0)
|
||||
{
|
||||
NSTimeInterval d;
|
||||
|
||||
d = _lastOperation - _lastStart;
|
||||
if (d >= _duration)
|
||||
{
|
||||
[self debug: @"Duration %g for query %@", d, stmt];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cacheHit = YES;
|
||||
}
|
||||
|
||||
if (seconds == 0)
|
||||
|
@ -3585,6 +3580,19 @@ static int poolConnections = 0;
|
|||
*/
|
||||
result = [[result mutableCopy] autorelease];
|
||||
}
|
||||
|
||||
_lastOperation = GSTickerTimeNow();
|
||||
if (_duration >= 0)
|
||||
{
|
||||
NSTimeInterval d;
|
||||
|
||||
d = _lastOperation - _lastStart;
|
||||
if (d >= _duration)
|
||||
{
|
||||
[self debug: @"Duration %g for cache-%@ query %@",
|
||||
d, (YES == cacheHit) ? @"hit" : @"miss", stmt];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue