Skip to content

Instantly share code, notes, and snippets.

@galaris
Last active April 17, 2020 22:19
Show Gist options
  • Save galaris/3afe6abc6feb0a7e4fc1949230fe9458 to your computer and use it in GitHub Desktop.
Save galaris/3afe6abc6feb0a7e4fc1949230fe9458 to your computer and use it in GitHub Desktop.
Atto benchmark result parser
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
using System.Windows.Forms;
namespace ATTOParser
{
class Program
{
[STAThread]
static void Main(string[] args)
{
XmlSerializer serializer = null;
string[] AttoResultFiles = Directory.GetFiles(@"c:\Users\usr\source\repos\ATTOParser\ATTOParser\bin\Debug\", "*.bmk");
Console.WriteLine("Found " + AttoResultFiles.Count() + " ATTO result files...");
foreach (string AttoResultFilePath in AttoResultFiles)
{
StringBuilder resultString = new StringBuilder();
Console.WriteLine("Reading " + AttoResultFilePath);
serializer = new XmlSerializer(typeof(benchmark));
benchmark AttoResultFileParsed = (benchmark)serializer.Deserialize(new XmlTextReader(AttoResultFilePath));
foreach (benchmarkRate rate in AttoResultFileParsed.rates)
{
string readSpeed = string.Empty;
string writeSpeed = string.Empty;
/*
ATTO 512b read
ATTO 512b write
ATTO 4kb read
ATTO 4kb write
ATTO 8kb read
ATTO 8kb write
ATTO 16kb read
ATTO 16kb write
ATTO 32kb read
ATTO 32kb write
ATTO 64kb read
ATTO 64kb write
ATTO 128kb read
ATTO 128kb write
ATTO 1mb read
ATTO 1mb write
*/
if (rate.iosize == "512")
{
readSpeed = GetMBPerSec(rate.readbps);
writeSpeed = GetMBPerSec(rate.writebps);
resultString.Append(readSpeed + " MB/s");
resultString.Append("\t");
resultString.Append(writeSpeed + " MB/s");
resultString.Append("\t");
Console.WriteLine("ATTO 512b read " + readSpeed + " MB/s \t");
Console.WriteLine("ATTO 512b write " + writeSpeed + " MB/s \t");
}
if (rate.iosize == "4096")
{
readSpeed = GetMBPerSec(rate.readbps);
writeSpeed = GetMBPerSec(rate.writebps);
resultString.Append(readSpeed + " MB/s");
resultString.Append("\t");
resultString.Append(writeSpeed + " MB/s");
resultString.Append("\t");
Console.WriteLine("ATTO 4kb read " + readSpeed + " MB/s \t");
Console.WriteLine("ATTO 4kb write " + writeSpeed + " MB/s \t");
}
if (rate.iosize == "8192")
{
readSpeed = GetMBPerSec(rate.readbps);
writeSpeed = GetMBPerSec(rate.writebps);
resultString.Append(readSpeed + " MB/s");
resultString.Append("\t");
resultString.Append(writeSpeed + " MB/s");
resultString.Append("\t");
Console.WriteLine("ATTO 8kb read " + readSpeed + " MB/s \t");
Console.WriteLine("ATTO 8kb write " + writeSpeed + " MB/s \t");
}
if (rate.iosize == "16384")
{
readSpeed = GetMBPerSec(rate.readbps);
writeSpeed = GetMBPerSec(rate.writebps);
resultString.Append(readSpeed + " MB/s");
resultString.Append("\t");
resultString.Append(writeSpeed + " MB/s");
resultString.Append("\t");
Console.WriteLine("ATTO 16kb read " + readSpeed + " MB/s \t");
Console.WriteLine("ATTO 16kb write " + writeSpeed + " MB/s \t");
}
if (rate.iosize == "32768")
{
readSpeed = GetMBPerSec(rate.readbps);
writeSpeed = GetMBPerSec(rate.writebps);
resultString.Append(readSpeed + " MB/s");
resultString.Append("\t");
resultString.Append(writeSpeed + " MB/s");
resultString.Append("\t");
Console.WriteLine("ATTO 32kb read " + readSpeed + " MB/s \t");
Console.WriteLine("ATTO 32kb write " + writeSpeed + " MB/s \t");
}
if (rate.iosize == "65536")
{
readSpeed = GetMBPerSec(rate.readbps);
writeSpeed = GetMBPerSec(rate.writebps);
resultString.Append(readSpeed + " MB/s");
resultString.Append("\t");
resultString.Append(writeSpeed + " MB/s");
resultString.Append("\t");
Console.WriteLine("ATTO 64kb read " + readSpeed + " MB/s \t");
Console.WriteLine("ATTO 64kb write " + writeSpeed + " MB/s \t");
}
if (rate.iosize == "131072")
{
readSpeed = GetMBPerSec(rate.readbps);
writeSpeed = GetMBPerSec(rate.writebps);
resultString.Append(readSpeed + " MB/s");
resultString.Append("\t");
resultString.Append(writeSpeed + " MB/s");
resultString.Append("\t");
Console.WriteLine("ATTO 128kb read " + readSpeed + " MB/s \t");
Console.WriteLine("ATTO 128kb write " + writeSpeed + " MB/s \t");
}
if (rate.iosize == "1048576")
{
readSpeed = GetMBPerSec(rate.readbps);
writeSpeed = GetMBPerSec(rate.writebps);
resultString.Append(readSpeed + " MB/s");
resultString.Append("\t");
resultString.Append(writeSpeed + " MB/s");
resultString.Append("\t");
Console.WriteLine("ATTO 1mb read " + readSpeed + " MB/s \t");
Console.WriteLine("ATTO 1mb write " + writeSpeed + " MB/s \t");
}
}
Clipboard.SetText(resultString.ToString());
Console.ReadKey();
}
Console.ReadKey();
}
public static string GetMBPerSec(string bps)
{
return ((float)Convert.ToInt32(bps) / (float)1024 / (float)1024).ToString("F2");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace ATTOParser
{
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by xsd, Version=4.8.3928.0.
//
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class benchmark
{
private string driveField;
private string descriptionField;
private string verifydataField;
private string directioField;
private string bypasswritecacheField;
private string continuousioField;
private string ioruntimeField;
private string queuedepthField;
private string patternField;
private string iosize1Field;
private string iosize2Field;
private string filesizeField;
private benchmarkRate[] ratesField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string drive
{
get
{
return this.driveField;
}
set
{
this.driveField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string description
{
get
{
return this.descriptionField;
}
set
{
this.descriptionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string verifydata
{
get
{
return this.verifydataField;
}
set
{
this.verifydataField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string directio
{
get
{
return this.directioField;
}
set
{
this.directioField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string bypasswritecache
{
get
{
return this.bypasswritecacheField;
}
set
{
this.bypasswritecacheField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string continuousio
{
get
{
return this.continuousioField;
}
set
{
this.continuousioField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string ioruntime
{
get
{
return this.ioruntimeField;
}
set
{
this.ioruntimeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string queuedepth
{
get
{
return this.queuedepthField;
}
set
{
this.queuedepthField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string pattern
{
get
{
return this.patternField;
}
set
{
this.patternField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string iosize1
{
get
{
return this.iosize1Field;
}
set
{
this.iosize1Field = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string iosize2
{
get
{
return this.iosize2Field;
}
set
{
this.iosize2Field = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string filesize
{
get
{
return this.filesizeField;
}
set
{
this.filesizeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("rate", typeof(benchmarkRate), Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public benchmarkRate[] rates
{
get
{
return this.ratesField;
}
set
{
this.ratesField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class benchmarkRate
{
private string iosizeField;
private string writebpsField;
private string writeiopsField;
private string readbpsField;
private string readiopsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string iosize
{
get
{
return this.iosizeField;
}
set
{
this.iosizeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string writebps
{
get
{
return this.writebpsField;
}
set
{
this.writebpsField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string writeiops
{
get
{
return this.writeiopsField;
}
set
{
this.writeiopsField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string readbps
{
get
{
return this.readbpsField;
}
set
{
this.readbpsField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string readiops
{
get
{
return this.readiopsField;
}
set
{
this.readiopsField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class NewDataSet
{
private benchmark[] itemsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("benchmark")]
public benchmark[] Items
{
get
{
return this.itemsField;
}
set
{
this.itemsField = value;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment