Spring Cleaning, Part Ichi (1)

Various minor things done to project files
Updated sample extension project file and updated makefile to the new unified version (more changes likely on the way)
Updated regex project file and makefile

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401971
This commit is contained in:
Scott Ehlert
2008-03-30 07:00:22 +00:00
commit 251cced1f8
801 changed files with 280074 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
using System;
using System.Collections;
using System.Text;
using System.Windows.Forms;
namespace profviewer
{
class LIStringComparator : IComparer
{
private int m_col;
public LIStringComparator(int col)
{
m_col = col;
}
public int Compare(object x, object y)
{
ListViewItem a = (ListViewItem)x;
ListViewItem b = (ListViewItem)y;
return String.Compare(a.SubItems[m_col].Text, b.SubItems[m_col].Text);
}
}
class LIIntComparator : IComparer
{
private int m_col;
public LIIntComparator(int col)
{
m_col = col;
}
public int Compare(object x, object y)
{
ListViewItem a = (ListViewItem)x;
ListViewItem b = (ListViewItem)y;
int num1 = Int32.Parse(a.SubItems[m_col].Text);
int num2 = Int32.Parse(b.SubItems[m_col].Text);
if (num1 > num2)
{
return -1;
}
else if (num1 < num2)
{
return 1;
}
return 0;
}
}
class LIDoubleComparator : IComparer
{
private int m_col;
public LIDoubleComparator(int col)
{
m_col = col;
}
public int Compare(object x, object y)
{
ListViewItem a = (ListViewItem)x;
ListViewItem b = (ListViewItem)y;
double num1 = Double.Parse(a.SubItems[m_col].Text);
double num2 = Double.Parse(b.SubItems[m_col].Text);
if (num1 > num2)
{
return -1;
}
else if (num1 < num2)
{
return 1;
}
return 0;
}
}
}
+243
View File
@@ -0,0 +1,243 @@
namespace profviewer
{
partial class Main
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.report_list = new System.Windows.Forms.ListView();
this.pr_type = new System.Windows.Forms.ColumnHeader();
this.pr_name = new System.Windows.Forms.ColumnHeader();
this.pr_calls = new System.Windows.Forms.ColumnHeader();
this.pr_avg_time = new System.Windows.Forms.ColumnHeader();
this.pr_min_time = new System.Windows.Forms.ColumnHeader();
this.pr_max_time = new System.Windows.Forms.ColumnHeader();
this.pr_total_time = new System.Windows.Forms.ColumnHeader();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menu_file_open = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.menu_file_exit = new System.Windows.Forms.ToolStripMenuItem();
this.label1 = new System.Windows.Forms.Label();
this.report_info_starttime = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.report_info_duration = new System.Windows.Forms.Label();
this.dialog_open = new System.Windows.Forms.OpenFileDialog();
this.panel1 = new System.Windows.Forms.Panel();
this.menuStrip1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// report_list
//
this.report_list.AllowColumnReorder = true;
this.report_list.AutoArrange = false;
this.report_list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.pr_type,
this.pr_name,
this.pr_calls,
this.pr_avg_time,
this.pr_min_time,
this.pr_max_time,
this.pr_total_time});
this.report_list.Dock = System.Windows.Forms.DockStyle.Fill;
this.report_list.Location = new System.Drawing.Point(0, 24);
this.report_list.MultiSelect = false;
this.report_list.Name = "report_list";
this.report_list.Size = new System.Drawing.Size(759, 300);
this.report_list.TabIndex = 0;
this.report_list.UseCompatibleStateImageBehavior = false;
this.report_list.View = System.Windows.Forms.View.Details;
this.report_list.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.report_list_ColumnClick);
//
// pr_type
//
this.pr_type.Text = "Type";
this.pr_type.Width = 71;
//
// pr_name
//
this.pr_name.Text = "Name";
this.pr_name.Width = 270;
//
// pr_calls
//
this.pr_calls.Text = "Calls";
this.pr_calls.Width = 61;
//
// pr_avg_time
//
this.pr_avg_time.Text = "Avg Time";
this.pr_avg_time.Width = 74;
//
// pr_min_time
//
this.pr_min_time.Text = "Min Time";
this.pr_min_time.Width = 78;
//
// pr_max_time
//
this.pr_max_time.Text = "Max Time";
this.pr_max_time.Width = 77;
//
// pr_total_time
//
this.pr_total_time.Text = "Total Time";
this.pr_total_time.Width = 84;
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(759, 24);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menu_file_open,
this.toolStripMenuItem1,
this.menu_file_exit});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// menu_file_open
//
this.menu_file_open.Name = "menu_file_open";
this.menu_file_open.Size = new System.Drawing.Size(100, 22);
this.menu_file_open.Text = "&Open";
this.menu_file_open.Click += new System.EventHandler(this.menu_file_open_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(97, 6);
//
// menu_file_exit
//
this.menu_file_exit.Name = "menu_file_exit";
this.menu_file_exit.Size = new System.Drawing.Size(100, 22);
this.menu_file_exit.Text = "E&xit";
this.menu_file_exit.Click += new System.EventHandler(this.menu_file_exit_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(76, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Profile Started:";
//
// report_info_starttime
//
this.report_info_starttime.AutoSize = true;
this.report_info_starttime.Location = new System.Drawing.Point(79, 13);
this.report_info_starttime.Name = "report_info_starttime";
this.report_info_starttime.Size = new System.Drawing.Size(0, 13);
this.report_info_starttime.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(264, 13);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(82, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Profile Duration:";
//
// report_info_duration
//
this.report_info_duration.AutoSize = true;
this.report_info_duration.Location = new System.Drawing.Point(346, 13);
this.report_info_duration.Name = "report_info_duration";
this.report_info_duration.Size = new System.Drawing.Size(0, 13);
this.report_info_duration.TabIndex = 5;
//
// dialog_open
//
this.dialog_open.Filter = "Profiler files|*.xml|All files|*.*";
//
// panel1
//
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.report_info_duration);
this.panel1.Controls.Add(this.report_info_starttime);
this.panel1.Controls.Add(this.label2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 324);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(759, 33);
this.panel1.TabIndex = 6;
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(759, 357);
this.Controls.Add(this.report_list);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.panel1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "Main";
this.Text = "SourceMod Profiler Report Viewer";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListView report_list;
private System.Windows.Forms.ColumnHeader pr_type;
private System.Windows.Forms.ColumnHeader pr_name;
private System.Windows.Forms.ColumnHeader pr_calls;
private System.Windows.Forms.ColumnHeader pr_avg_time;
private System.Windows.Forms.ColumnHeader pr_min_time;
private System.Windows.Forms.ColumnHeader pr_max_time;
private System.Windows.Forms.ColumnHeader pr_total_time;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem menu_file_open;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem menu_file_exit;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label report_info_starttime;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label report_info_duration;
private System.Windows.Forms.OpenFileDialog dialog_open;
private System.Windows.Forms.Panel panel1;
}
}
+98
View File
@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace profviewer
{
public partial class Main : Form
{
private ProfileReport m_Report;
public Main()
{
InitializeComponent();
}
private void menu_file_open_Click(object sender, EventArgs e)
{
DialogResult res;
res = dialog_open.ShowDialog(this);
if (res != DialogResult.OK)
{
return;
}
m_Report = null;
try
{
m_Report = new ProfileReport(dialog_open.FileName);
}
catch (System.Exception ex)
{
MessageBox.Show("Error opening or parsing file: " + ex.Message);
}
UpdateListView();
}
private void UpdateListView()
{
ProfileItem atom;
ListViewItem item;
if (m_Report == null)
{
report_list.Items.Clear();
report_info_duration.Text = "";
report_info_starttime.Text = "";
return;
}
report_info_duration.Text = m_Report.Duration.ToString() + " seconds";
report_info_starttime.Text = m_Report.StartTime.ToString();
for (int i = 0; i < m_Report.Count; i++)
{
atom = m_Report.GetItem(i);
item = new ListViewItem(ProfileReport.TypeStrings[(int)atom.type]);
item.SubItems.Add(atom.name);
item.SubItems.Add(atom.num_calls.ToString());
item.SubItems.Add(atom.AverageTime.ToString("F6"));
item.SubItems.Add(atom.min_time.ToString("F6"));
item.SubItems.Add(atom.max_time.ToString("F6"));
item.SubItems.Add(atom.total_time.ToString("F6"));
report_list.Items.Add(item);
}
}
private void menu_file_exit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void report_list_ColumnClick(object sender, ColumnClickEventArgs e)
{
if (e.Column == 1)
{
report_list.ListViewItemSorter = new LIStringComparator(1);
}
else if (e.Column == 2)
{
report_list.ListViewItemSorter = new LIIntComparator(2);
}
else if (e.Column > 2)
{
report_list.ListViewItemSorter = new LIDoubleComparator(e.Column);
}
}
}
}
+126
View File
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="dialog_open.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
</root>
+159
View File
@@ -0,0 +1,159 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace profviewer
{
enum ProfileType : int
{
ProfType_Unknown = 0,
ProfType_Native,
ProfType_Callback,
ProfType_Function
}
class ProfileItem
{
public string name;
public double total_time;
public uint num_calls;
public double min_time;
public double max_time;
public ProfileType type;
public double AverageTime
{
get
{
return total_time / num_calls;
}
}
}
class ProfileReport
{
public static string[] TypeStrings;
private DateTime m_start_time;
private double m_duration;
private List<ProfileItem> m_Items;
public int Count
{
get
{
return m_Items.Count;
}
}
static ProfileReport()
{
TypeStrings = new string[4];
TypeStrings[0] = "unknown";
TypeStrings[1] = "native";
TypeStrings[2] = "callback";
TypeStrings[3] = "function";
}
public ProfileReport(string file)
{
bool in_profile;
ProfileType type;
string cur_report;
XmlTextReader xml;
xml = new XmlTextReader(file);
xml.WhitespaceHandling = WhitespaceHandling.None;
m_Items = new List<ProfileItem>();
type = ProfileType.ProfType_Unknown;
in_profile = false;
cur_report = null;
while (xml.Read())
{
if (xml.NodeType == XmlNodeType.Element)
{
if (xml.Name.CompareTo("profile") == 0)
{
int t;
in_profile = true;
m_duration = Double.Parse(xml.GetAttribute("uptime"));
m_start_time = new DateTime(1970, 1, 1, 0, 0, 0);
t = Int32.Parse(xml.GetAttribute("time"));
m_start_time = m_start_time.AddSeconds(t);
}
else if (in_profile)
{
if (xml.Name.CompareTo("report") == 0)
{
cur_report = xml.GetAttribute("name");
if (cur_report.CompareTo("natives") == 0)
{
type = ProfileType.ProfType_Native;
}
else if (cur_report.CompareTo("callbacks") == 0)
{
type = ProfileType.ProfType_Callback;
}
else if (cur_report.CompareTo("functions") == 0)
{
type = ProfileType.ProfType_Function;
}
else
{
type = ProfileType.ProfType_Unknown;
}
}
else if (xml.Name.CompareTo("item") == 0 && cur_report != null)
{
ProfileItem item;
item = new ProfileItem();
item.name = xml.GetAttribute("name");
item.max_time = Double.Parse(xml.GetAttribute("maxtime"));
item.min_time = Double.Parse(xml.GetAttribute("mintime"));
item.num_calls = UInt32.Parse(xml.GetAttribute("numcalls"));
item.total_time = Double.Parse(xml.GetAttribute("totaltime"));
item.type = type;
m_Items.Add(item);
}
}
}
else if (xml.NodeType == XmlNodeType.EndElement)
{
if (xml.Name.CompareTo("profile") == 0)
{
break;
}
else if (xml.Name.CompareTo("report") == 0)
{
cur_report = null;
}
}
}
}
public double Duration
{
get
{
return m_duration;
}
}
public DateTime StartTime
{
get
{
return m_start_time;
}
}
public ProfileItem GetItem(int i)
{
return m_Items[i];
}
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace profviewer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main());
}
}
}
+80
View File
@@ -0,0 +1,80 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1EE11F57-B933-4D06-B0E6-EAFB60ACAC73}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>profviewer</RootNamespace>
<AssemblyName>profviewer</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Comparators.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="ProfReport.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<SubType>Designer</SubType>
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+20
View File
@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "profviewer", "profviewer.csproj", "{1EE11F57-B933-4D06-B0E6-EAFB60ACAC73}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1EE11F57-B933-4D06-B0E6-EAFB60ACAC73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EE11F57-B933-4D06-B0E6-EAFB60ACAC73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EE11F57-B933-4D06-B0E6-EAFB60ACAC73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EE11F57-B933-4D06-B0E6-EAFB60ACAC73}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,73 @@
<?php
class ProfReport
{
public $time;
public $uptime;
public $items = array();
}
class ProfReportParser
{
private $report;
private $curtype;
public $last_error;
public function Parse($file)
{
$this->report = FALSE;
$this->curtype = FALSE;
if (($contents = file_get_contents($file)) === FALSE)
{
$this->last_error = 'File not found';
return FALSE;
}
$xml = xml_parser_create();
xml_set_object($xml, $this);
xml_set_element_handler($xml, 'tag_open', 'tag_close');
xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, false);
if (!xml_parse($xml, $contents))
{
$this->last_error = 'Line: ' . xml_get_current_line_number($xml) . ' -- ' . xml_error_string(xml_get_error_code($xml));
return FALSE;
}
return $this->report;
}
public function tag_open($parser, $tag, $attrs)
{
if ($tag == 'profile')
{
$this->report = new ProfReport();
$this->report->time = $attrs['time'];
$this->report->uptime = $attrs['uptime'];
}
else if ($tag == 'report')
{
$this->curtype = $attrs['name'];
}
else if ($tag == 'item')
{
if ($this->report === FALSE || $this->curtype === FALSE)
{
return;
}
$attrs['type'] = $this->curtype;
$this->report->items[] = $attrs;
}
}
public function tag_close($parser, $tag)
{
if ($tag == 'report')
{
$this->curtype = FALSE;
}
}
}
?>