qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [patch] IDE busmaster DMA support


From: Joe Batt
Subject: Re: [Qemu-devel] [patch] IDE busmaster DMA support
Date: Tue, 27 Sep 2005 07:23:16 -0500

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 <address@hidden>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]