mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 05:18:38 +00:00
Readding Cosmos compiler profiler. Still needs fixed up to match current code.
This commit is contained in:
parent
24c27d23ef
commit
ce9180d15a
7 changed files with 236 additions and 1 deletions
|
|
@ -188,9 +188,11 @@ Project("{471EC4BB-E47E-4229-A789-D1F5F83B52D4}") = "SSchockeTestBoot", "..\sour
|
|||
{0AAD9114-6F08-4344-A282-CD6BC77595E5} = {0AAD9114-6F08-4344-A282-CD6BC77595E5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.IL2CPU.Profiler", "..\source2\IL2CPU\Cosmos.IL2CPU.Profiler\Cosmos.IL2CPU.Profiler.csproj", "{F708C866-1C9B-4579-8C28-0728ECCFC1ED}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TeamFoundationVersionControl) = preSolution
|
||||
SccNumberOfProjects = 48
|
||||
SccNumberOfProjects = 49
|
||||
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs04
|
||||
SccLocalPath0 = .
|
||||
|
|
@ -384,6 +386,10 @@ Global
|
|||
SccProjectTopLevelParentUniqueName47 = Cosmos.sln
|
||||
SccProjectName47 = ../source2/Users/SSchocke/SSchockeTest
|
||||
SccLocalPath47 = ..\\source2\\Users\\SSchocke\\SSchockeTest
|
||||
SccProjectUniqueName48 = ..\\source2\\IL2CPU\\Cosmos.IL2CPU.Profiler\\Cosmos.IL2CPU.Profiler.csproj
|
||||
SccProjectTopLevelParentUniqueName48 = Cosmos.sln
|
||||
SccProjectName48 = ../source2/IL2CPU/Cosmos.IL2CPU.Profiler
|
||||
SccLocalPath48 = ..\\source2\\IL2CPU\\Cosmos.IL2CPU.Profiler
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Bootstrap|Any CPU = Bootstrap|Any CPU
|
||||
|
|
@ -1135,6 +1141,21 @@ Global
|
|||
{4527D60E-25F4-4617-B463-7CDA3C219097}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{4527D60E-25F4-4617-B463-7CDA3C219097}.Release|x86.ActiveCfg = Release|x86
|
||||
{4527D60E-25F4-4617-B463-7CDA3C219097}.Release|x86.Build.0 = Release|x86
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Bootstrap|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Bootstrap|Any CPU.Build.0 = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Bootstrap|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Bootstrap|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Bootstrap|x86.ActiveCfg = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -1182,6 +1203,7 @@ Global
|
|||
{52BF0A64-EBEF-420A-9F27-6C5226A4B77B} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
|
||||
{C801F19C-A9D3-42D5-9A57-9FFDF9B4D05E} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
|
||||
{239E33A7-F0C3-4801-85CA-4D8F89A31DC0} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
|
||||
{F708C866-1C9B-4579-8C28-0728ECCFC1ED} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
|
||||
{6658FCE0-7032-4B7B-BD95-F2765C393442} = {2DF5F17F-4890-4856-ADFD-4DE23282C3B7}
|
||||
{6882C74B-3ED2-4D76-9E7B-67B6A28808BC} = {0CF14D0F-6054-4D3D-9062-E3D2EB064A4E}
|
||||
{23476FAD-3712-4A4B-90C0-CCCC9AC8D953} = {0CF14D0F-6054-4D3D-9062-E3D2EB064A4E}
|
||||
|
|
|
|||
24
source2/IL2CPU/Cosmos.IL2CPU.Profiler/Assembler.cs
Normal file
24
source2/IL2CPU/Cosmos.IL2CPU.Profiler/Assembler.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Cosmos.IL2CPU.Profiler {
|
||||
public class Assembler : Cosmos.IL2CPU.Assembler {
|
||||
|
||||
protected override void InitILOps() {
|
||||
var xILOp = new ILOp(this);
|
||||
// Don't change the type in the foreach to a var, its necessary as it is now
|
||||
// to typecast it, so we can then recast to an int.
|
||||
foreach (ILOpCode.Code xCode in Enum.GetValues(typeof(ILOpCode.Code))) {
|
||||
int xCodeValue = (int)xCode;
|
||||
if (xCodeValue <= 0xFF) {
|
||||
mILOpsLo[xCodeValue] = xILOp;
|
||||
} else {
|
||||
mILOpsHi[xCodeValue & 0xFF] = xILOp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F708C866-1C9B-4579-8C28-0728ECCFC1ED}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.IL2CPU.Profiler</RootNamespace>
|
||||
<AssemblyName>Cosmos.IL2CPU.Profiler</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<UpgradeBackupLocation />
|
||||
</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>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</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>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Assembler.cs" />
|
||||
<Compile Include="ILOp.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\source\Cosmos.Hardware.Plugs\Cosmos.Hardware.Plugs.csproj">
|
||||
<Project>{BCB66614-20FE-4184-B214-FD42844AD8A6}</Project>
|
||||
<Name>Cosmos.Hardware.Plugs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\source\Cosmos\Cosmos.Kernel.Plugs\Cosmos.Kernel.Plugs.csproj">
|
||||
<Project>{B168BEDD-C6A6-4E7C-B9A5-0144286E9E42}</Project>
|
||||
<Name>Cosmos.Kernel.Plugs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\source\Cosmos\Cosmos.Sys.Plugs\Cosmos.Sys.Plugs.csproj">
|
||||
<Project>{6110AD07-EB07-4A99-BB73-7A69AF5732F1}</Project>
|
||||
<Name>Cosmos.Sys.Plugs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Cosmos.IL2CPU\Cosmos.IL2CPU.csproj">
|
||||
<Project>{239E33A7-F0C3-4801-85CA-4D8F89A31DC0}</Project>
|
||||
<Name>Cosmos.IL2CPU</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\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>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
13
source2/IL2CPU/Cosmos.IL2CPU.Profiler/ILOp.cs
Normal file
13
source2/IL2CPU/Cosmos.IL2CPU.Profiler/ILOp.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
|
||||
namespace Cosmos.IL2CPU.Profiler {
|
||||
public class ILOp : Cosmos.IL2CPU.ILOp {
|
||||
public ILOp(Cosmos.IL2CPU.Assembler aAsmblr)
|
||||
: base(aAsmblr) {
|
||||
}
|
||||
|
||||
public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) {
|
||||
// Do Nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
47
source2/IL2CPU/Cosmos.IL2CPU.Profiler/Program.cs
Normal file
47
source2/IL2CPU/Cosmos.IL2CPU.Profiler/Program.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
|
||||
namespace Cosmos.IL2CPU.Profiler {
|
||||
class Program {
|
||||
|
||||
// This program profiles the scanning engine.
|
||||
// In the future it may profile other aspects as well.
|
||||
|
||||
static void Main(string[] args) {
|
||||
DoScan();
|
||||
}
|
||||
|
||||
private static void DoScan() {
|
||||
var xSW = new Stopwatch();
|
||||
xSW.Start();
|
||||
|
||||
var xAsmblr = new Assembler();
|
||||
var xScanner = new ILScanner(xAsmblr);
|
||||
//TODO: Add plugs into the scanning equation to profile scanning them too
|
||||
var xEntryPoint = typeof(Program).GetMethod("ScannerEntryPoint", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
xScanner.Execute(xEntryPoint);
|
||||
|
||||
xSW.Stop();
|
||||
Console.WriteLine("Total time : {0}", xSW.Elapsed);
|
||||
Console.WriteLine("Method count: {0}", xScanner.MethodCount);
|
||||
//Console.WriteLine("Instruction count: {0}", xScanner.InstructionCount);
|
||||
}
|
||||
|
||||
// This is a dummy entry point for the scanner to start at.
|
||||
// Its not even a Cosmos app, just a standard Windows console app,
|
||||
// but that fine for the scanner profiling as it does
|
||||
// not actually compile it.
|
||||
private static void ScannerEntryPoint() {
|
||||
Console.WriteLine("Hello, World!");
|
||||
var xInt = 0;
|
||||
object xObj = xInt;
|
||||
xObj.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Cosmos.IL2CPU.Profiler")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Cosmos.IL2CPU.Profiler")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e4553c3e-1412-4524-8ac0-d2da7c9465b6")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Loading…
Reference in a new issue