Changeset 2622


Ignore:
Timestamp:
5/11/2012 2:51:36 AM (2 years ago)
Author:
lowjoel
Message:

Handle a FileNotFound? exception in the middle of querying performance information since a disk may be ejected in the middle of the loop.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.DefaultPlugins/EntropySources/KernelEntropySource.cs

    r2515 r2622  
    178178            foreach (VolumeInfo info in VolumeInfo.Volumes) 
    179179            { 
    180                 DiskPerformanceInfo performance = info.Performance; 
    181                 if (performance == null) 
    182                     continue; 
    183  
    184                 result.AddRange(StructToBuffer(performance.BytesRead)); 
    185                 result.AddRange(StructToBuffer(performance.BytesWritten)); 
    186                 result.AddRange(StructToBuffer(performance.IdleTime)); 
    187                 result.AddRange(StructToBuffer(performance.QueryTime)); 
    188                 result.AddRange(StructToBuffer(performance.QueueDepth)); 
    189                 result.AddRange(StructToBuffer(performance.ReadCount)); 
    190                 result.AddRange(StructToBuffer(performance.ReadTime)); 
    191                 result.AddRange(StructToBuffer(performance.SplitCount)); 
    192                 result.AddRange(StructToBuffer(performance.WriteCount)); 
    193                 result.AddRange(StructToBuffer(performance.WriteTime)); 
     180                try 
     181                { 
     182                    DiskPerformanceInfo performance = info.Performance; 
     183                    if (performance == null) 
     184                        continue; 
     185 
     186                    result.AddRange(StructToBuffer(performance.BytesRead)); 
     187                    result.AddRange(StructToBuffer(performance.BytesWritten)); 
     188                    result.AddRange(StructToBuffer(performance.IdleTime)); 
     189                    result.AddRange(StructToBuffer(performance.QueryTime)); 
     190                    result.AddRange(StructToBuffer(performance.QueueDepth)); 
     191                    result.AddRange(StructToBuffer(performance.ReadCount)); 
     192                    result.AddRange(StructToBuffer(performance.ReadTime)); 
     193                    result.AddRange(StructToBuffer(performance.SplitCount)); 
     194                    result.AddRange(StructToBuffer(performance.WriteCount)); 
     195                    result.AddRange(StructToBuffer(performance.WriteTime)); 
     196                } 
     197                catch (FileNotFoundException) 
     198                { 
     199                    //This happens if a drive is ejected while the loop is running. 
     200                } 
    194201            } 
    195202 
Note: See TracChangeset for help on using the changeset viewer.