diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2010-11-15 12:02:16 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2010-11-15 14:39:13 -0800 |
commit | 1539387a23672ee0145f681b88f374f0b078c19e (patch) | |
tree | 2eff2f16dbff9145663e85d4310b5eecf29a4593 /MobileCydia.mm | |
parent | fd119f42f8f2894fd3f38dfd8bcd75b973fe18b3 (diff) |
Verbose logging support for #define HistogramInsertionSort.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index e73cfe7..faf2dc1 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -384,7 +384,7 @@ static const CFStringCompareFlags LaxCompareFlags_ = kCFCompareCaseInsensitive | #define ForRelease 1 #define TraceLogging (1 && !ForRelease) -#define HistogramInsertionSort (0 && !ForRelease) +#define HistogramInsertionSort (!ForRelease ? 0 : 0) #define ProfileTimes (0 && !ForRelease) #define ForSaurik (0 && !ForRelease) #define LogBrowser (0 && !ForRelease) @@ -560,7 +560,7 @@ void CFArrayInsertionSortValues(CFMutableArrayRef array, CFRange range, CFCompar const void **values(new const void *[range.length]); CFArrayGetValues(array, range, values); -#if HistogramInsertionSort +#if HistogramInsertionSort > 0 uint32_t total(0), *offsets(new uint32_t[range.length]); #endif @@ -568,9 +568,13 @@ void CFArrayInsertionSortValues(CFMutableArrayRef array, CFRange range, CFCompar const void *value(values[index]); //CFIndex correct(SKBSearch_(&value, sizeof(const void *), values, index, comparator, context)); CFIndex correct(index); - while (comparator(value, values[correct - 1], context) == kCFCompareLessThan) + while (comparator(value, values[correct - 1], context) == kCFCompareLessThan) { +#if HistogramInsertionSort > 1 + NSLog(@"%@ < %@", value, values[correct - 1]); +#endif if (--correct == 0) break; + } if (correct != index) { size_t offset(index - correct); #if HistogramInsertionSort @@ -587,7 +591,7 @@ void CFArrayInsertionSortValues(CFMutableArrayRef array, CFRange range, CFCompar CFArrayReplaceValues(array, range, values, range.length); delete [] values; -#if HistogramInsertionSort +#if HistogramInsertionSort > 0 for (CFIndex index(0); index != range.length; ++index) if (offsets[index] != 0) NSLog(@"Insertion Displacement [%u]: %u", index, offsets[index]); |