FIOSAP Profiler

Suppose you have used Performance Monitor and determined that the disk is a bottleneck that is adversely affecting the performance of your application, Zapdata. None of the tools we've discussed so far will be of much help.

The File I/O and Synchronization Win32 API Profiler (FIOSAP) is designed to profile applications that might have multiple concurrent threads. The file I/O and synchronization functions are contained in KERNEL32.DLL. The profiler is in the form of a single FERNEL32.DLL, to be used with KERNEL32 DLL. This DLL sits between your application and KERNEL32.DLL, intercepts file I/O and synchronization function calls to KERNEL32.DLL, and then makes and times a call to the actual function. It also collects useful statistics about the overall file, event, mutex, and semaphore activity of the application. This tool is available in the Platform SDK.

FERNEL32.DLL reports the number of operations, the total time, and average time in each operation, as well as the additional statistics for some of these operations. The following list shows exactly what additional operations are measured. Times are expressed in microseconds.

The profiling DLL also records the following information for each synchronization handle that the process uses:

To profile a list of applications with FIOSAP, type:

apf32cvt fernel32 <app list>

where <app list> is a list of one or more names of the executable applications or DLLs that are to be profiled during the profiling run. Note that <app list> must be the last argument to APF32CVT. For the Zapdata application we are looking at in this example, we type:

apf32cvt fernel32 zapdata.exe

The following output shows part of the results of the run of FIOSAP on Zapdata for file statistics:

---------------------------------------------------------------------
File: E:\wimblton.dat
----------+---------+----------+---------+---------+--------+--------
Operation |  Total  |Number of | Average |  Total  |  Mean  | Std Dev
   Name   |   Time  |operations|   Time  |  Bytes  | Bytes  |  Bytes 
----------+---------+----------+---------+---------+--------+--------
Overall   |   972726|        21|    46320|        -|       -|        
Create    |     1578|         1|     1578|        -|       -|        
Read      |   970334|        18|    53907|  1170432|   65024|        
Info      |      348|         1|      348|        -|       -|        
Close     |      466|         1|      466|        -|       -|        

---------------------------------------------------------------------
Statistics for all file activity  (Number of files used: 6)
----------+---------+----------+---------+---------+--------+--------
Operation |  Total  |Number of | Average |  Total  |  Mean  | Std Dev
   Name   |   Time  |operations|   Time  |  Bytes  | Bytes  |  Bytes 
----------+---------+----------+---------+---------+--------+--------
Overall   | 23965469|       375|    63907|        -|       -|        
Create    |    94046|         6|    15674|        -|       -|        
Read      | 17244253|       180|    95801| 11704320|   65024|        
Write     |  6432526|       177|    36341| 11455298|   64719|  762713
Info      |   117536|         6|    19589|        -|       -|        
Close     |    77108|         6|    12851|        -|       -|        
 

The following output shows part of the results of the run of FIOSAP on Zapdata for event and semaphore statistics:

-------------------------------------------------------
Event:    Type: Auto Reset
----------+---------+----------+---------+-------------
Operation |  Total  |Number of | Average |  Successful 
   Name   |   Time  |operations|   Time  |    Waits    
----------+---------+----------+---------+-------------
Overall   |  9482271|       231|    41048|            -
Create    |      265|         1|      265|            -
Set       |   410876|       129|     3185|            -
Wait      |  9070985|       100|    90709|          100
   Single |  9070985|       100|    90709|          100
Close     |      145|         1|      145|            -

-------------------------------------------------------
Semaphore: Duplicate Semaphore           Max Count: 0
----------+---------+----------+---------+-------------
Operation |  Total  |Number of | Average |  Successful 
   Name   |   Time  |operations|   Time  |    Waits    
----------+---------+----------+---------+-------------
Overall   |    49972|         2|    24986|            -
Close     |    49972|         2|    24986|            -
 

Data from FIOSAP is written to FERNEL32.END, in the working directory of the application. FIOSAP will write data from concurrent multiple threads to the same data file, and there is no method for separating the data based on threads. However, FIOSAP will write data from concurrent multiple processes to different data files, as long as the profiled concurrent processes have different working directories. If you have two concurrent processes with the same working directory, the data for one of them will be lost.

You can use this procedure whenever you want to know what your application is waiting for when it is not using the processor.