-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4de8e2a
commit 79d1316
Showing
150 changed files
with
47,730 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@interface BaseNSLogging : NSObject | ||
|
||
+ (void)speedTest0; | ||
+ (void)speedTest1; | ||
+ (void)speedTest2; | ||
+ (void)speedTest3; | ||
+ (void)speedTest4; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#import "BaseNSLogging.h" | ||
#import "PerformanceTesting.h" | ||
|
||
#define DDLogVerbose NSLog | ||
#define DDLogInfo NSLog | ||
#define DDLogWarn NSLog | ||
#define DDLogError NSLog | ||
|
||
#define FILENAME @"BaseNSLogging " // Trailing space to match exactly the others in length | ||
|
||
|
||
@implementation BaseNSLogging | ||
|
||
+ (void)speedTest0 | ||
{ | ||
// Log statements that will not be executed due to log level | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_0_COUNT; i++) | ||
{ | ||
DDLogVerbose(@"%@: SpeedTest0 - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
+ (void)speedTest1 | ||
{ | ||
// Log statements that will be executed asynchronously | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_1_COUNT; i++) | ||
{ | ||
DDLogWarn(@"%@: SpeedTest1 - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
+ (void)speedTest2 | ||
{ | ||
// Log statements that will be executed synchronously | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_2_COUNT; i++) | ||
{ | ||
DDLogError(@"%@: SpeedTest2 - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
+ (void)speedTest3 | ||
{ | ||
// Even Spread: | ||
// | ||
// 25% - Not executed due to log level | ||
// 50% - Executed asynchronously | ||
// 25% - Executed synchronously | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_3_COUNT; i++) | ||
{ | ||
DDLogError(@"%@: SpeedTest3A - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_3_COUNT; i++) | ||
{ | ||
DDLogWarn(@"%@: SpeedTest3B - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_3_COUNT; i++) | ||
{ | ||
DDLogInfo(@"%@: SpeedTest3C - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_3_COUNT; i++) | ||
{ | ||
DDLogVerbose(@"%@: SpeedTest3D - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
+ (void)speedTest4 | ||
{ | ||
// Custom Spread | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_4_ERROR_COUNT; i++) | ||
{ | ||
DDLogError(@"%@: SpeedTest4A - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_4_WARN_COUNT; i++) | ||
{ | ||
DDLogWarn(@"%@: SpeedTest4B - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_4_INFO_COUNT; i++) | ||
{ | ||
DDLogInfo(@"%@: SpeedTest4C - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_4_VERBOSE_COUNT; i++) | ||
{ | ||
DDLogVerbose(@"%@: SpeedTest4D - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@interface DynamicLogging : NSObject | ||
|
||
+ (void)speedTest0; | ||
+ (void)speedTest1; | ||
+ (void)speedTest2; | ||
+ (void)speedTest3; | ||
+ (void)speedTest4; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#import "DynamicLogging.h" | ||
#import "PerformanceTesting.h" | ||
#import "DDLog.h" | ||
|
||
#define FILENAME @"DynamicLogging" | ||
|
||
// Debug levels: off, error, warn, info, verbose | ||
static int ddLogLevel = LOG_LEVEL_WARN; // NOT CONST | ||
|
||
|
||
@implementation DynamicLogging | ||
|
||
+ (int)ddLogLevel | ||
{ | ||
return ddLogLevel; | ||
} | ||
|
||
+ (void)ddSetLogLevel:(int)logLevel | ||
{ | ||
ddLogLevel = logLevel; | ||
} | ||
|
||
+ (void)speedTest0 | ||
{ | ||
// Log statements that will not be executed due to log level | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_0_COUNT; i++) | ||
{ | ||
DDLogVerbose(@"%@: SpeedTest0 - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
+ (void)speedTest1 | ||
{ | ||
// Log statements that will be executed asynchronously | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_1_COUNT; i++) | ||
{ | ||
DDLogWarn(@"%@: SpeedTest1 - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
+ (void)speedTest2 | ||
{ | ||
// Log statements that will be executed synchronously | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_2_COUNT; i++) | ||
{ | ||
DDLogError(@"%@: SpeedTest2 - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
+ (void)speedTest3 | ||
{ | ||
// Even Spread: | ||
// | ||
// 25% - Not executed due to log level | ||
// 50% - Executed asynchronously | ||
// 25% - Executed synchronously | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_3_COUNT; i++) | ||
{ | ||
DDLogError(@"%@: SpeedTest3A - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_3_COUNT; i++) | ||
{ | ||
DDLogWarn(@"%@: SpeedTest3B - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_3_COUNT; i++) | ||
{ | ||
DDLogInfo(@"%@: SpeedTest3C - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_3_COUNT; i++) | ||
{ | ||
DDLogVerbose(@"%@: SpeedTest3D - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
+ (void)speedTest4 | ||
{ | ||
// Custom Spread | ||
|
||
for (NSUInteger i = 0; i < SPEED_TEST_4_ERROR_COUNT; i++) | ||
{ | ||
DDLogError(@"%@: SpeedTest4A - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_4_WARN_COUNT; i++) | ||
{ | ||
DDLogWarn(@"%@: SpeedTest4B - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_4_INFO_COUNT; i++) | ||
{ | ||
DDLogInfo(@"%@: SpeedTest4C - %lu", FILENAME, (unsigned long)i); | ||
} | ||
for (NSUInteger i = 0; i < SPEED_TEST_4_VERBOSE_COUNT; i++) | ||
{ | ||
DDLogVerbose(@"%@: SpeedTest4D - %lu", FILENAME, (unsigned long)i); | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
#define SPEED_TEST_0_COUNT 1000 // Total log statements | ||
#define SPEED_TEST_1_COUNT 1000 // Total log statements | ||
#define SPEED_TEST_2_COUNT 1000 // Total log statements | ||
#define SPEED_TEST_3_COUNT 250 // Per log level (multiply by 4 to get total) | ||
|
||
#define SPEED_TEST_4_VERBOSE_COUNT 900 | ||
#define SPEED_TEST_4_INFO_COUNT 000 | ||
#define SPEED_TEST_4_WARN_COUNT 000 | ||
#define SPEED_TEST_4_ERROR_COUNT 100 | ||
|
||
// Further documentation on these tests may be found in the implementation file. | ||
|
||
@interface PerformanceTesting : NSObject | ||
|
||
+ (void)startPerformanceTests; | ||
|
||
@end |
Oops, something went wrong.