On Mon, 2005-09-26 at 21:48 -0400, John Coiner wrote: > Can anyone shed light on the potential performance to be realized? For > example, how long does a context switch take in the guest? If it takes > 10ms (one disk seek) then there's probably no benefit to concurrent disk > IO. If a context switch takes 1ms, then the guest has opportunity to > make forward progress while awaiting an IDE interrupt.
I ran this code to time context switches: #include <sys/time.h> #include <time.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { struct timeval start; gettimeofday(&start, NULL); int fd[2]; pipe(fd); int child = fork(); int i, count = 100000; char *msg = malloc(2); strcpy(msg, "m"); for (i = 0; i < count; i++) { if (child) { if (write(fd[1], msg, 1) != 1) fprintf(stderr, "FAILURE\n"); } else { if (read(fd[0], msg, 1) != 1) fprintf(stderr, "FAILURE\n"); } } struct timeval end; gettimeofday(&end, NULL); printf("%g microseconds/context switch\n", (((end.tv_sec - start.tv_sec) * (double)1000000) + end.tv_usec - start.tv_usec)/count); return 0; } On my dual 2.4 Ghz Xeon, I get the following timings. host:~ > ./yieldtest 2.35418 microseconds/context switch 2.35414 microseconds/context switch KNOPPIX guest: > ./yieldtest 105.092 microseconds/context switch 105.184 microseconds/context switch Is that what you are after? -- Joe Batt <[EMAIL PROTECTED]> _______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel