Skip to content
Snippets Groups Projects
Commit fe745079 authored by George Nachman's avatar George Nachman
Browse files

Add precise timers to TaskNotifier to measure time in and out of select().

parent 03156a78
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -58,7 +58,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Development"
buildConfiguration = "Deployment"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Loading
Loading
Loading
Loading
@@ -10,6 +10,7 @@
#import "Coprocess.h"
#import "DebugLogging.h"
#import "PTYTask.h"
#import "iTermPreciseTimer.h"
 
#define PtyTaskDebugLog(args...)
 
Loading
Loading
@@ -235,6 +236,14 @@ void UnblockTaskNotifier(void) {
int highfd;
NSEnumerator* iter;
NSAutoreleasePool* autoreleasePool = [[NSAutoreleasePool alloc] init];
iTermPreciseTimerStats stats[2];
iTermPreciseTimerStats *selectTimer = &stats[0];
iTermPreciseTimerStats *busyTimer = &stats[1];
iTermPreciseTimerStatsInit(selectTimer, "select");
iTermPreciseTimerStatsInit(busyTimer, "busy");
iTermPreciseTimerStatsStartTimer(busyTimer);
 
// FIXME: replace this with something better...
for(;;) {
Loading
Loading
@@ -349,7 +358,18 @@ void UnblockTaskNotifier(void) {
[[NSNotificationCenter defaultCenter] postNotificationName:kTaskNotifierDidSpin object:nil];
 
// Poll...
if (select(highfd+1, &rfds, &wfds, &efds, NULL) <= 0) {
iTermPreciseTimerStatsMeasureAndRecordTimer(busyTimer);
iTermPreciseTimerPeriodicLog(stats, sizeof(stats) / sizeof(*stats), 1);
iTermPreciseTimerStatsStartTimer(selectTimer);
int selectResult = select(highfd+1, &rfds, &wfds, &efds, NULL);
iTermPreciseTimerStatsMeasureAndRecordTimer(selectTimer);
iTermPreciseTimerStatsStartTimer(busyTimer);
if (selectResult <= 0) {
switch(errno) {
case EAGAIN:
case EINTR:
Loading
Loading
Loading
Loading
@@ -200,6 +200,9 @@ typedef struct iTermTextColorContext {
[[NSColor redColor] set];
NSRectFill(rect);
}
if (rect.size.height > 100) {
rect.size.height = 100;
}
[self updateCachedMetrics];
// If there are two or more rects that need display, the OS will pass in |rect| as the smallest
// bounding rect that contains them all. Luckily, we can get the list of the "real" dirty rects
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment