From 74d1c92669e9795990964607b783e739391fb100 Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Thu, 16 Jul 2015 12:57:56 +0000 Subject: [PATCH] Implement -sizeInBytesExcluding: on GSFIFO git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/performance/trunk@38809 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 4 ++++ GSFIFO.m | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a11354a..c952204 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-07-16 Niels Grewe + + * GSFIFO.m: Implement -sizeInBytesExcluding: + 2015-07-15 Richard Frith-Macdonald * GSCache.m: Experimental change (use in conjunction with gnustep-base diff --git a/GSFIFO.m b/GSFIFO.m index 77d3b90..4b12c5e 100644 --- a/GSFIFO.m +++ b/GSFIFO.m @@ -209,7 +209,7 @@ stats(NSTimeInterval ti, uint32_t max, NSTimeInterval *bounds, uint64_t *bands) // We do not need to signal the condition because // nothing about the qeuue did change [condition unlock]; - return NULL;; + return NULL; } void *ptr = _items[_tail % _capacity]; [condition unlock]; @@ -900,5 +900,21 @@ stats(NSTimeInterval ti, uint32_t max, NSTimeInterval *bounds, uint64_t *bands) return NO; } +- (NSUInteger)sizeInBytesExcluding: (NSHashTable*)excluding +{ + NSUInteger size = 0; + if (0 == (size = [super sizeInBytesExcluding: excluding])) + { + return 0; + } + return size + + (_capacity * sizeof(void)) // item storage + + (boundsCount * sizeof(NSTimeInterval)) // boundaries + + (2 * (boundsCount + 1) * sizeof(uint64_t)) // get and put counts + + [condition sizeInBytesExcluding: excluding] + + [name sizeInBytesExcluding: excluding] + + [putThread sizeInBytesExcluding: excluding] + + [getThread sizeInBytesExcluding: excluding]; +} @end