1
0
Форкнуть 0
This commit is contained in:
Javier Suárez Ruiz 2019-06-01 11:23:11 +02:00
Родитель ba7eb499fc
Коммит bd2e7b0cf7
132 изменённых файлов: 15436 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1 @@
Thanks to Chris King for his amazing Profiler and to Shane Neuville for his help.

Просмотреть файл

@ -0,0 +1,31 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using VisualPerformance.Droid.Services;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
namespace VisualPerformance.Droid
{
[Activity(
Label = "VisualPerformance",
Icon = "@mipmap/icon",
Theme = "@style/MainTheme",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
Profile.Start();
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
Forms.Init(this, savedInstanceState);
FormsMaterial.Init(this, savedInstanceState);
DependencyService.Register<ProfilerService>();
LoadApplication(new App());
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 4.6 KiB

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 11 KiB

После

Ширина:  |  Высота:  |  Размер: 11 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.7 KiB

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 6.3 KiB

После

Ширина:  |  Высота:  |  Размер: 6.3 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 6.9 KiB

После

Ширина:  |  Высота:  |  Размер: 6.9 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 18 KiB

После

Ширина:  |  Высота:  |  Размер: 18 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 12 KiB

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 33 KiB

После

Ширина:  |  Высота:  |  Размер: 33 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 19 KiB

После

Ширина:  |  Высота:  |  Размер: 19 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 51 KiB

После

Ширина:  |  Высота:  |  Размер: 51 KiB

Просмотреть файл

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
<OutputType>Library</OutputType>
<RootNamespace>VisualPerformance.Droid</RootNamespace>
<AssemblyName>VisualPerformance.Android</AssemblyName>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AotAssemblies>true</AotAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AotAssemblies>true</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.1.0.471358-pre1" />
<PackageReference Include="Xamarin.Forms.Visual.Material">
<Version>4.1.0.471358-pre1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\ProfilerTimeHelper.cs" />
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\ProfilerService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\Tabbar.axml" />
<AndroidResource Include="Resources\layout\Toolbar.axml" />
<AndroidResource Include="Resources\values\styles.xml" />
<AndroidResource Include="Resources\values\colors.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\drawable-hdpi\" />
<Folder Include="Resources\drawable-xhdpi\" />
<Folder Include="Resources\drawable-xxhdpi\" />
<Folder Include="Resources\drawable-xxxhdpi\" />
<Folder Include="Resources\drawable\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VisualPerformance\VisualPerformance.csproj">
<Project>{5AA03230-5C60-4743-9D77-A97146F56090}</Project>
<Name>VisualPerformance</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 69 KiB

После

Ширина:  |  Высота:  |  Размер: 69 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 3.7 KiB

После

Ширина:  |  Высота:  |  Размер: 3.7 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 4.6 KiB

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 4.6 KiB

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 5.1 KiB

После

Ширина:  |  Высота:  |  Размер: 5.1 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 1.3 KiB

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 845 B

После

Ширина:  |  Высота:  |  Размер: 845 B

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 1.7 KiB

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.5 KiB

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.3 KiB

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.4 KiB

После

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.7 KiB

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 8.7 KiB

После

Ширина:  |  Высота:  |  Размер: 8.7 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 10 KiB

После

Ширина:  |  Высота:  |  Размер: 10 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 34 KiB

После

Ширина:  |  Высота:  |  Размер: 34 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 7.1 KiB

После

Ширина:  |  Высота:  |  Размер: 7.1 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 8.2 KiB

После

Ширина:  |  Высота:  |  Размер: 8.2 KiB

Просмотреть файл

@ -0,0 +1,165 @@
<?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)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{6143fdea-f3c2-4a09-aafa-6e230626515e}</TemplateGuid>
<OutputType>Exe</OutputType>
<RootNamespace>VisualPerformance.iOS</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>VisualPerformance.iOS</AssemblyName>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<BuildIpa>True</BuildIpa>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="Services\ProfilerService.cs" />
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon152.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon120.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon87.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon80.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon76.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon60.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon58.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon40.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon29.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon20.png">
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.1.0.471358-pre1" />
<PackageReference Include="Xamarin.Forms.Visual.Material">
<Version>4.1.0.471358-pre1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\VisualPerformance\VisualPerformance.csproj">
<Project>{DA0FF6E6-32B5-4C7A-926A-95B68A8E9393}</Project>
<Name>VisualPerformance</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
</Project>

Просмотреть файл

@ -0,0 +1,135 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Xaml;
public class Datum
{
public string Name;
public string Id;
public long Ticks;
public long SubTicks;
public int Depth;
public string Path;
public int Line;
}
public static class ContentPageEx
{
const long MS = TimeSpan.TicksPerMillisecond;
public static List<Datum> Data = new List<Datum>();
private static void ASSERT(bool condition)
{
if (!condition) throw new Exception("assert");
}
private static long GatherTicks(ref int i)
{
var current = Data[i++];
var depth = current.Depth;
var total = current.Ticks;
while (i < Data.Count)
{
var next = Data[i];
if (next.Depth < depth)
break;
if (next.Depth > depth)
{
current.SubTicks = GatherTicks(ref i);
ASSERT(current.Ticks >= current.SubTicks);
continue;
}
i++;
current = next;
total += current.Ticks;
}
return total;
}
private static void AppendProfile(StringBuilder sb, long profiledMs, bool showZeros)
{
foreach (var datum in Data)
{
var depth = datum.Depth;
var name = datum.Name;
if (datum.Id != null)
name += $" ({datum.Id})";
var ticksMs = datum.Ticks / MS;
var exclusiveTicksMs = (datum.Ticks - datum.SubTicks) / MS;
var percentage = (int)Math.Round(ticksMs / (double)profiledMs * 100);
if (!showZeros && percentage == 0)
continue;
var line = $"{name} = {ticksMs}ms";
if (exclusiveTicksMs != ticksMs)
line += $" ({exclusiveTicksMs}ms)";
line += $", {percentage}%";
sb.AppendLine("".PadLeft(depth * 2) + line);
}
}
public static ContentPage LoadProfile(this ContentPage page)
{
Profile.Stop();
foreach (var datum in Profile.Data)
{
Data.Add(new Datum()
{
Name = datum.Name,
Id = datum.Id,
Depth = datum.Depth,
Ticks = datum.Ticks < 0 ? 0L : (long)datum.Ticks
});
}
var i = 0;
var profiledMs = GatherTicks(ref i) / MS;
var scrollView = new ScrollView();
var label = new Label();
var controls = new Grid();
var buttonA = new Button() { Text = "0s", HeightRequest = 62 };
controls.Children.AddHorizontal(new[] { buttonA });
var grid = new Grid
{
RowDefinitions = new RowDefinitionCollection {
new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
new RowDefinition { Height = GridLength.Auto },
},
ColumnDefinitions = new ColumnDefinitionCollection {
new ColumnDefinition { Width = GridLength.Star },
}
};
page.Content = grid;
grid.Children.Add(scrollView, 0, 0);
grid.Children.Add(controls, 0, 1);
scrollView.Content = label;
var showZeros = false;
Action update = delegate ()
{
var sb = new StringBuilder();
sb.AppendLine($"Profiled: {profiledMs}ms");
AppendProfile(sb, profiledMs, showZeros);
label.Text = sb.ToString();
};
buttonA.Clicked += delegate { showZeros = !showZeros; update(); };
update();
return page;
}
}

Просмотреть файл

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8" ?>
<base:ProfilerPage
xmlns:base="clr-namespace:VisualPerformance.Views.Base"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="VisualPerformance.Views.MainView">
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="PerfFrameStyle" TargetType="Frame">
<Setter Property="VerticalOptions" Value="Center" />
<Setter Property="HasShadow" Value="True" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Margin" Value="12" />
</Style>
<Style x:Key="PerfPanelStyle" TargetType="StackLayout">
<Setter Property="Spacing" Value="10" />
<Setter Property="BackgroundColor" Value="White" />
<Setter Property="Margin" Value="12" />
</Style>
<Style x:Key="SignInTitleStyle" TargetType="Label">
<Setter Property="FontSize" Value="24" />
<Setter Property="TextColor" Value="Black" />
<Setter Property="Margin" Value="0, 12, 0, 0" />
</Style>
<Style TargetType="Entry">
<Setter Property="PlaceholderColor" Value="OrangeRed" />
<Setter Property="BackgroundColor" Value="LightGray" />
</Style>
<Style x:Key="PerfButtontyle" TargetType="Button">
<Setter Property="FontSize" Value="18" />
<Setter Property="TextColor" Value="White" />
<Setter Property="BackgroundColor" Value="OrangeRed" />
<Setter Property="Margin" Value="0, 0, 0, 12" />
</Style>
<Style x:Key="PerfLabelStyle" TargetType="Label">
<Setter Property="HorizontalOptions" Value="End" />
<Setter Property="VerticalOptions" Value="End" />
<Setter Property="Margin" Value="6" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<Grid
BackgroundColor="DarkGray">
<Frame
Visual="Material"
Style="{StaticResource PerfFrameStyle}">
<StackLayout
Style="{StaticResource PerfPanelStyle}">
<Label
Visual="Material"
Text="Label1"/>
<Label
Visual="Material"
Text="Label2"/>
<ProgressBar
Visual="Material"
ProgressColor="Orange"
Progress="0.5"/>
<ProgressBar
Visual="Material"
ProgressColor="Orange"
Progress="0.2"/>
<Slider
Visual="Material" />
<Slider
/>
<Entry
Visual="Material" />
<Entry
Visual="Material" />
<Button
Visual="Material"
AutomationId="materialButton"
Text="Sign in"
Style="{StaticResource PerfButtontyle}"/>
<Button
Visual="Material"
AutomationId="defaultButton"
Text="Click me to see performance"
Clicked="Handle_Clicked"
Style="{StaticResource PerfButtontyle}"/>
</StackLayout>
</Frame>
<Label
Text="{Binding Timing}"
Style="{StaticResource PerfLabelStyle}"/>
</Grid>
</ContentPage.Content>
</base:ProfilerPage>

Просмотреть файл

@ -0,0 +1,38 @@
using System;
using System.Diagnostics;
using VisualPerformance.Services;
using VisualPerformance.ViewModels;
using VisualPerformance.Views.Base;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
namespace VisualPerformance.Views
{
public partial class MainView : ProfilerPage
{
void Handle_Clicked(object sender, System.EventArgs e)
{
long count = 0;
foreach (var datum in Profile.Data)
{
count += datum.Ticks;
long ms = datum.Ticks / TimeSpan.TicksPerMillisecond;
Debug.WriteLine($"{datum.Name}-{datum.Id}: {ms} ms {count}");
}
Navigation.PushModalAsync(new ContentPage().LoadProfile());
}
public MainView ()
{
InitializeComponent ();
BindingContext = new MainViewModel(DependencyService.Get<IProfilerService>());
}
protected override async void OnAppearing()
{
base.OnAppearing();
await (BindingContext as MainViewModel).LoadDataAsync();
}
}
}

Просмотреть файл

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.1.0.471358-pre1" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Views\MainView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,143 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.645
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPerformance.Android", "VisualPerformance\VisualPerformance.Android\VisualPerformance.Android.csproj", "{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPerformance.iOS", "VisualPerformance\VisualPerformance.iOS\VisualPerformance.iOS.csproj", "{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualPerformance", "VisualPerformance\VisualPerformance\VisualPerformance.csproj", "{5AA03230-5C60-4743-9D77-A97146F56090}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
Ad-Hoc|iPhone = Ad-Hoc|iPhone
Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator
AppStore|Any CPU = AppStore|Any CPU
AppStore|iPhone = AppStore|iPhone
AppStore|iPhoneSimulator = AppStore|iPhoneSimulator
Debug|Any CPU = Debug|Any CPU
Debug|iPhone = Debug|iPhone
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|Any CPU = Release|Any CPU
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|Any CPU.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|Any CPU.Deploy.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|iPhone.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|iPhone.Deploy.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|iPhone.Build.0 = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|Any CPU.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|Any CPU.Deploy.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|iPhone.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|iPhone.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|iPhone.Deploy.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{0EA8A4FF-69BD-4CD0-A793-04DFE6A9486B}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|Any CPU.Build.0 = Ad-Hoc|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|Any CPU.Deploy.0 = Ad-Hoc|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|iPhone.Deploy.0 = Ad-Hoc|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Ad-Hoc|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|Any CPU.Build.0 = AppStore|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|Any CPU.Deploy.0 = AppStore|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|iPhone.Build.0 = AppStore|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|iPhone.Deploy.0 = AppStore|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.AppStore|iPhoneSimulator.Deploy.0 = AppStore|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|Any CPU.Deploy.0 = Debug|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|iPhone.ActiveCfg = Debug|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|iPhone.Build.0 = Debug|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|iPhone.Deploy.0 = Debug|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Debug|iPhoneSimulator.Deploy.0 = Debug|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|Any CPU.ActiveCfg = Release|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|Any CPU.Build.0 = Release|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|Any CPU.Deploy.0 = Release|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|iPhone.ActiveCfg = Release|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|iPhone.Build.0 = Release|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|iPhone.Deploy.0 = Release|iPhone
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{85F1A158-375C-4F07-9C3A-C8FEC9DE0384}.Release|iPhoneSimulator.Deploy.0 = Release|iPhoneSimulator
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|Any CPU.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|iPhone.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|Any CPU.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|iPhone.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|iPhone.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.AppStore|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|iPhone.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|Any CPU.Build.0 = Release|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|Any CPU.Deploy.0 = Release|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|iPhone.ActiveCfg = Release|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|iPhone.Build.0 = Release|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|iPhone.Deploy.0 = Release|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{5AA03230-5C60-4743-9D77-A97146F56090}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FD376A8F-4236-453E-AA32-669E5F261379}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".
These files will be deployed with you package and will be accessible using Android's
AssetManager, like this:
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
Additionally, some Android functions will automatically load asset files:
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

Просмотреть файл

@ -0,0 +1,67 @@
using Java.IO;
using Java.Lang;
using System;
using System.Globalization;
namespace VisualPerformance.Droid.Helpers
{
// Based on: https://github.com/toomasz/XamarinAppStartupTime
// By Tomasz Ścisłowicz
public class ProfilerTimeHelper
{
const string LogcatTimeFormat = "yyyy-MM-dd HH:mm:ss.fff";
private static DateTime? StartupTime;
private static bool _attemptedToGetStartupTime;
public static DateTime? GetAppStartupTime()
{
if (_attemptedToGetStartupTime)
{
return StartupTime;
}
if (!StartupTime.HasValue)
{
StartupTime = GetStartupTimeFromLogcat();
_attemptedToGetStartupTime = true;
}
return StartupTime;
}
private static DateTime? GetStartupTimeFromLogcat()
{
var pid = Android.OS.Process.MyPid();
var process = new ProcessBuilder().
RedirectErrorStream(true).
Command("/system/bin/logcat", $"--pid={pid}", "-m", "1", "-v", "year").Start();
using (var bufferedReader = new BufferedReader(new InputStreamReader(process.InputStream)))
{
string line = null;
while ((line = bufferedReader.ReadLine()) != null)
{
if (ParseLogDateTime(line, out DateTime date))
{
return date;
}
}
}
return null;
}
private static bool ParseLogDateTime(string logLine, out DateTime dateTime)
{
if (logLine.Length < LogcatTimeFormat.Length)
{
dateTime = new DateTime();
return false;
}
var timeStr = logLine.Substring(0, LogcatTimeFormat.Length);
return DateTime.TryParseExact(timeStr, LogcatTimeFormat,
CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out dateTime);
}
}
}

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.VisualPerformance">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="VisualPerformance.Android"></application>
</manifest>

Просмотреть файл

@ -0,0 +1,34 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;
// 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("VisualPerformance.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VisualPerformance.Android")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// 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")]
// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

Просмотреть файл

@ -0,0 +1,50 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.
For example, a sample Android app that contains a user interface layout (main.xml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:
Resources/
drawable-hdpi/
icon.png
drawable-ldpi/
icon.png
drawable-mdpi/
icon.png
layout/
main.xml
values/
strings.xml
In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called
"Resource" that contains the tokens for each one of the resources included. For example,
for the above Resources layout, this is what the Resource class would expose:
public class Resource {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
string in the dictionary file values/strings.xml.

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:tabIndicatorColor="@android:color/white"
app:tabGravity="fill"
app:tabMode="fixed" />

Просмотреть файл

@ -0,0 +1,9 @@
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/launcher_background" />
<foreground android:drawable="@mipmap/launcher_foreground" />
</adaptive-icon>

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/launcher_background" />
<foreground android:drawable="@mipmap/launcher_foreground" />
</adaptive-icon>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 11 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 6.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 6.9 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 33 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 19 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 51 KiB

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="launcher_background">#FFFFFF</color>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

Просмотреть файл

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#2196F3</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#1976D2</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#FF4081</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>

Просмотреть файл

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using VisualPerformance.Droid.Helpers;
using VisualPerformance.Services;
namespace VisualPerformance.Droid.Services
{
public class ProfilerService : IProfilerService
{
private static Dictionary<string, DateTime?> _eventTimingsSinceStartup = new Dictionary<string, DateTime?>();
public static void RegisterInternalEvent(string eventName)
{
if (_eventTimingsSinceStartup.ContainsKey(eventName))
{
return;
}
_eventTimingsSinceStartup.Add(eventName, DateTime.Now);
}
public void RegisterEvent(string eventName)
{
RegisterInternalEvent(eventName);
}
public async Task<Dictionary<string, TimeSpan?>> GetTimingsSinceStartup()
{
return await Task.Factory.StartNew(() =>
{
var timings = new Dictionary<string, TimeSpan?>();
var startupTime = ProfilerTimeHelper.GetAppStartupTime();
foreach (var eventInfo in _eventTimingsSinceStartup)
{
timings.Add(eventInfo.Key, eventInfo.Value - startupTime);
}
return timings;
});
}
public DateTime? GetStartupTime()
{
return ProfilerTimeHelper.GetAppStartupTime();
}
}
}

Просмотреть файл

@ -0,0 +1,29 @@
using Foundation;
using UIKit;
using Xamarin.Forms;
namespace VisualPerformance.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Forms.Init();
FormsMaterial.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
{
"images": [
{
"scale": "2x",
"size": "20x20",
"idiom": "iphone",
"filename": "Icon40.png"
},
{
"scale": "3x",
"size": "20x20",
"idiom": "iphone",
"filename": "Icon60.png"
},
{
"scale": "2x",
"size": "29x29",
"idiom": "iphone",
"filename": "Icon58.png"
},
{
"scale": "3x",
"size": "29x29",
"idiom": "iphone",
"filename": "Icon87.png"
},
{
"scale": "2x",
"size": "40x40",
"idiom": "iphone",
"filename": "Icon80.png"
},
{
"scale": "3x",
"size": "40x40",
"idiom": "iphone",
"filename": "Icon120.png"
},
{
"scale": "2x",
"size": "60x60",
"idiom": "iphone",
"filename": "Icon120.png"
},
{
"scale": "3x",
"size": "60x60",
"idiom": "iphone",
"filename": "Icon180.png"
},
{
"scale": "1x",
"size": "20x20",
"idiom": "ipad",
"filename": "Icon20.png"
},
{
"scale": "2x",
"size": "20x20",
"idiom": "ipad",
"filename": "Icon40.png"
},
{
"scale": "1x",
"size": "29x29",
"idiom": "ipad",
"filename": "Icon29.png"
},
{
"scale": "2x",
"size": "29x29",
"idiom": "ipad",
"filename": "Icon58.png"
},
{
"scale": "1x",
"size": "40x40",
"idiom": "ipad",
"filename": "Icon40.png"
},
{
"scale": "2x",
"size": "40x40",
"idiom": "ipad",
"filename": "Icon80.png"
},
{
"scale": "1x",
"size": "76x76",
"idiom": "ipad",
"filename": "Icon76.png"
},
{
"scale": "2x",
"size": "76x76",
"idiom": "ipad",
"filename": "Icon152.png"
},
{
"scale": "2x",
"size": "83.5x83.5",
"idiom": "ipad",
"filename": "Icon167.png"
},
{
"scale": "1x",
"size": "1024x1024",
"idiom": "ios-marketing",
"filename": "Icon1024.png"
}
],
"properties": {},
"info": {
"version": 1,
"author": "xcode"
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 69 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.1 KiB

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше