TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Jonathan de Boyne Pollard
date: 1995-09-01 09:55:08
subject: dossubset

PE>
  >                                                 This program
  > when profiled registers 95% of the time spent in DosSubSet!!!
  >
  > #include 
  >
  > static char buf[30000];
  >
  > int main(void)
  > {
  >     int x;
  >     FILE *fq;
  >
  >     fq = fopen("temp.txt", "wb");
  >     for (x = 0; x < 2000; x++)
  >     {
  >         fwrite(buf, sizeof buf, 1, fq);
  >     }
  >     fclose(fq);
  >     return (0);
  > }
PE>

  Stop and think.  Your profiler cannot register time spent in a device
  or filesystem driver, nor does it register time spent blocked waiting
  for I/O requests to complete in the bottom half of the kernel.

  Therefore the 95% figure for DosSubSet is a percentage of the time
  spent outside of I/O, not for the total execution time of your
  application.

  Considering that your program does little else *other* than I/O, what
  you are actually measuring is the profiling information for the C++
  runtime startup and cleanup code and the buffering in the 
  library.  The library initialisation and terminating code does little
  else than allocate buffers (for things like `stdin' and the argument
  list) so it's unsurprising that profiling it reveals that most of its
  time is spent in memory management routines.  The same goes for the
   library.

  To "unskew" your profiling measurements, try putting some non-I/O code
  in the body of your program (generate a series of 1000 random numbers
  in every iteration of the loop, or something) and then profiling it.

  > JdeBP <
___
 X MegaMail 2.10 #0:

--- Maximus/2 3.00
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 440/4 141/209 270/101 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.