public void LogPerformanceWorkloadTest( out float MBPerSecond ) { try { //* Local functions Func <ILogManager> MakeManager = (() => { Task <ILogManager> t = LogManager.OpenAsync(LogManager.LoggerType.Default, CancellationToken.None); t.Wait(); return(t.Result); }); Func <ILogManager, string, Guid, long, uint, uint, IPhysicalLog> MakePhyLog = (( ILogManager manager, string pathToCommonContainer, Guid physicalLogId, long containerSize, uint maximumNumberStreams, uint maximumLogicalLogBlockSize) => { Task <IPhysicalLog> t = manager.CreatePhysicalLogAsync( pathToCommonContainer, physicalLogId, containerSize, maximumNumberStreams, maximumLogicalLogBlockSize, 0, // Physical logs are not sparse CancellationToken.None); t.Wait(); return(t.Result); }); Func <ILogManager, string, Guid, IPhysicalLog> OpenPhyLog = (( ILogManager manager, string pathToCommonContainer, Guid physicalLogId) => { Task <IPhysicalLog> t = manager.OpenPhysicalLogAsync( pathToCommonContainer, physicalLogId, false, CancellationToken.None); t.Wait(); return(t.Result); }); string physLogName = PlatformPathPrefix + _SharedDrive + PlatformPathDelimiter + "PerfWorkloadTestP.log"; ILogManager logManager = MakeManager(); try { File.Delete(physLogName.Substring(4)); } catch (Exception) { // ok if this fails } Console.WriteLine("Raw Record size is {0}", _RecordSize); Guid logId = Guid.NewGuid(); string logName = physLogName; IPhysicalLog phyLog = MakePhyLog( logManager, logName, logId, _LogSize, 0, 4 * _RecordSize); // // Determine the largest record size. We write full records to maximmize our I/O rate. // Max record size is determined by the Maximum block size plus the metadata space (4K) minus the // overhead of the headers. // //const int MaxLogBlkSize = 1024 * 1024; //const int recordSize = 131; CancellationTokenSource[] cancelToken = new CancellationTokenSource[_NumberTasks]; Task[] tasks = new Task[_NumberTasks]; ILogicalLog[] lLogs = new ILogicalLog[_NumberTasks]; int bytesToWrite = 1; this.StartPerfWorkloads.Reset(); for (int i = 0; i < _NumberTasks; i++) { // // MUltiply record size by 4 so log is created with correct geometry // Guid lLogId = Guid.NewGuid(); string logicalLogName = PlatformPathPrefix + _DedicatedDrive + PlatformPathDelimiter + "Perf" + lLogId.ToString() + ".log"; lLogs[i] = CreateLogicalLog(phyLog, lLogId, null, logicalLogName, null, _LlogSize, 4 * _RecordSize); lLogs[i].CloseAsync(CancellationToken.None).Wait(); lLogs[i] = null; lLogs[i] = OpenLogicalLog(phyLog, lLogId); // // Harvest the size of a complete buffer to write // bytesToWrite = (int)lLogs[i].MaximumBlockSize; } // // Get a buffer // Console.WriteLine("Each formatted record contains {0} bytes", bytesToWrite); StartWorkloadThreads(lLogs, _NumberTasks, (int)_RecordSize, cancelToken, out MBPerSecond); for (int i = 0; i < _NumberTasks; i++) { lLogs[i].CloseAsync(CancellationToken.None).Wait(); lLogs[i] = null; } phyLog.CloseAsync(CancellationToken.None).Wait(); phyLog = null; //* Cleanup logManager.DeletePhysicalLogAsync(logName, logId, CancellationToken.None).Wait(); logManager.CloseAsync(CancellationToken.None).Wait(); try { File.Delete(physLogName.Substring(4)); } catch (Exception) { // ok if this fails } } catch (Exception ex) { Console.WriteLine(ex.ToString()); throw; } }