Created
November 3, 2011 09:00
-
-
Save KristianLyng/1336084 to your computer and use it in GitHub Desktop.
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
| root@luke:~/tmpfs# rm tmp | |
| root@luke:~/tmpfs# time ../a.out > tmp; ls -sl tmp | |
| real 0m0.089s | |
| user 0m0.068s | |
| sys 0m0.020s | |
| 39148 -rw-r--r-- 1 root root 40000000 Nov 3 09:59 tmp | |
| root@luke:~/tmpfs# cat ../foo.c | |
| #include <stdlib.h> | |
| int main(void) { | |
| int i; | |
| long int a; | |
| char *b; | |
| char buff[100010]; | |
| int buflen=0; | |
| int intcounter; | |
| srandom(time(NULL)); | |
| b = (char *) &a; | |
| for (i=0;i < (40000000 / sizeof(long int));i++) { | |
| a = random(); | |
| for (intcounter=0; intcounter<sizeof(long int); intcounter++) | |
| buff[buflen+intcounter] = b[intcounter]; | |
| buflen+=intcounter; | |
| if (buflen > 100000){ | |
| write(1,buff,buflen); | |
| buflen=0; | |
| } | |
| } | |
| write(1,buff,buflen); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment