Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define BUFF_SIZE 250
- static int io_test(void)
- {
- struct tms timing; /* Timing information. */
- clock_t t0, t1; /* Elapsed times. */
- char *buffer[BUFF_SIZE];
- /* Allocate buffer. */
- for (int i = 0; i < BUFF_SIZE; i++)
- {
- buffer[i] = malloc(0x200000);
- if (buffer[i] == NULL)
- {
- printf("Error %d!\n", i);
- exit(EXIT_FAILURE);
- }
- }
- /* Fill buffer. */
- t0 = times(&timing);
- for (int i = 0; i < BUFF_SIZE; i++)
- for (int j = 0; j < 0x200000; j++)
- buffer[i][j] = 0x7F;
- t1 = times(&timing);
- /* House keeping. */
- for (int i = 0; i < BUFF_SIZE; i++)
- free(buffer[i]);
- /* Print timing statistics. */
- if (flags & VERBOSE)
- printf(" Elapsed: %d\n", t1 - t0);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement