Created
October 1, 2010 03:55
-
-
Save tsukkee/605700 to your computer and use it in GitHub Desktop.
scroll benchmark script for iTerm2
This file contains hidden or 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
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
void setline(char *s, int n) | |
{ | |
int l = random() % n; | |
int j; | |
for(j = 0; j < l; ++j) { | |
s[j] = 'A' + (random() % 60); | |
} | |
s[j] = 0; | |
} | |
int main(int argc, char *argv[]) | |
{ | |
int n; | |
if(argc == 1) { | |
n = 1000000; | |
} | |
else { | |
n = atoi(argv[1]); | |
} | |
int i; | |
for(i = 0; i < n; ++i) { | |
char buffer[100]; | |
setline(buffer, sizeof(buffer) - 1); | |
printf("%s\n", buffer); | |
if(i % 50 == 0) { | |
printf("%c[H", 27); | |
} | |
} | |
printf("\n\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment