public override void Execute(GameObject instigator = null)
    {
        GraphicOption    go   = GameOption.Get <GraphicOption>();
        SpaceshipOptions o    = GameOption.Get <SpaceshipOptions>();
        float            p    = o.screenPercentage / 100f;
        float            mPix = (go.width * p * go.height * p) / 1000000;
        string           sp   = o.screenPercentage == 100 ? $"Native" : $"{o.screenPercentage}% SP ({o.upsamplingMethod.ToString()})";

        FPSManager fpsm = Manager.Get <FPSManager>();

        QualityText.text          = $"{go.width}x{go.height}@{go.refreshRate}Hz ({go.fullScreenMode}) {sp} ({mPix.ToString("F2", System.Globalization.CultureInfo.InvariantCulture)} MPix) - {QualitySettings.names[QualitySettings.GetQualityLevel()]} Quality";
        OverallFPSText.text       = (1000 / fpsm.results.avgMs).ToString("F1", System.Globalization.CultureInfo.InvariantCulture);
        OverallMSText.text        = fpsm.results.avgMs.ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
        OverallMSPerMPixText.text = (fpsm.results.avgMs / mPix).ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
        WorstFPSText.text         = (1000 / fpsm.results.maxMs).ToString("F1", System.Globalization.CultureInfo.InvariantCulture);
        WorstMSText.text          = fpsm.results.maxMs.ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
        BestFPSText.text          = (1000 / fpsm.results.minMs).ToString("F1", System.Globalization.CultureInfo.InvariantCulture);
        BestMSText.text           = fpsm.results.minMs.ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
        CPUInfo.text = $"{SystemInfo.processorType} ({SystemInfo.processorCount} threads) @ { (SystemInfo.processorFrequency/1000f).ToString("F2", System.Globalization.CultureInfo.InvariantCulture)} GHz. ";
        RAMInfo.text = $"System Memory : { SystemInfo.systemMemorySize / 1000}GB";
        GPUInfo.text = $"{ SystemInfo.graphicsDeviceName} ({ SystemInfo.graphicsDeviceType}) { SystemInfo.graphicsMemorySize / 1000}GB VRAM";
    }
Exemple #2
0
    public float GetValue(int graphicLevel, string optionName)
    {
        GraphicOption resultSearch = settings.Find(option => option.name.Contains(optionName));
        float         value        = 0;

        switch (graphicLevel)
        {
        case 0:
            value = resultSearch.graphicFastest;
            break;

        case 1:
            value = resultSearch.graphicFast;
            break;

        case 2:
            value = resultSearch.graphicSimple;
            break;

        case 3:
            value = resultSearch.graphicGood;
            break;

        case 4:
            value = resultSearch.graphicBeautiful;
            break;

        case 5:
            value = resultSearch.graphicFantastic;
            break;

        case 6:
            value = resultSearch.graphicExtreme;
            break;
        }

        return(value);
    }
Exemple #3
0
    public void EndRecord(bool abort = false)
    {
        recording       = false;
        recordingPaused = false;

        if (abort || timings == null || timings.Count == 0)
        {
            return;
        }

        var currentCulture = System.Globalization.CultureInfo.CurrentCulture;

        System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

        string frameTimeStr = string.Join(",", timings);

        float med = 0f;
        float min = float.PositiveInfinity;
        float max = float.NegativeInfinity;

        foreach (var time in timings)
        {
            min  = Mathf.Min(time, min);
            max  = Mathf.Max(time, max);
            med += time;
        }

        med /= timings.Count;

        results = new RecordingResults
        {
            minMs = min,
            maxMs = max,
            avgMs = med
        };

        GraphicOption    go   = GameOption.Get <GraphicOption>();
        SpaceshipOptions o    = GameOption.Get <SpaceshipOptions>();
        float            p    = o.screenPercentage / 100f;
        float            mPix = (go.width * p * go.height * p) / 1000000;


        string dateTime        = $"{DateTime.Now.ToLongDateString()} {DateTime.Now.ToShortTimeString()}";
        string operatingSystem = $"{SystemInfo.operatingSystem}";
        string sp = o.screenPercentage == 100 ? $"Native" : $"{o.screenPercentage}% SP ({o.upsamplingMethod.ToString()})";

        string settings   = $"{go.width}x{go.height}@{go.refreshRate}Hz ({go.fullScreenMode}) {sp} ({mPix.ToString("F2")} MegaPixels)- {QualitySettings.names[QualitySettings.GetQualityLevel()]} Quality";
        string bestFPS    = $"{(1000 / min).ToString("F1")}fps ({min.ToString("F2")}ms)";
        string worstFPS   = $"{(1000 / max).ToString("F1")}fps ({max.ToString("F2")}ms)";
        string averageFPS = $"{(1000 / med).ToString("F1")}fps ({med.ToString("F2")}ms)";
        string msPerMPix  = $"{(med/mPix).ToString("F2")} ms/MPix";

        string systemInfo = $"{SystemInfo.deviceModel}";
        string cpuInfo    = $" {SystemInfo.processorType} ({SystemInfo.processorCount} threads) @ {(SystemInfo.processorFrequency / 1000f).ToString("F2")} GHz.";
        string gpuInfo    = $"{SystemInfo.graphicsDeviceName}({SystemInfo.graphicsDeviceType}) {SystemInfo.graphicsMemorySize / 1000}GB VRAM";
        string memInfo    = $"{SystemInfo.systemMemorySize / 1000}GB.";


#if UNITY_STANDALONE && !UNITY_EDITOR
        try
        {
            string myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string spaceshipPath   = Path.Combine(myDocumentsPath, "Spaceship Demo");

            if (!Directory.Exists(spaceshipPath))
            {
                Directory.CreateDirectory(spaceshipPath);
            }

            var writer = new StreamWriter($"{spaceshipPath}/{HTMLPath}");
            writer.Write(@$ "<html>
<head>
    <link href=" "https://cdnjs.cloudflare.com/ajax/libs/c3/0.7.20/c3.css" " rel=" "stylesheet" ">
    <link rel=" "preconnect" " href=" "https://fonts.gstatic.com" ">
    <link href=" "https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" " rel=" "stylesheet" ">
    <script src=" "https://cdnjs.cloudflare.com/ajax/libs/d3/5.16.0/d3.min.js" " charset=" "utf-8" " ></script>
    <script src=" "https://cdnjs.cloudflare.com/ajax/libs/c3/0.7.20/c3.min.js" "></script>
<style>
h1, h2, h3, h4, h5, body, p
{{
font-family: 'Roboto', sans-serif;
}}
</style>
</head>
<body>
<h1> Spaceship - Benchmark Results</h1>
<b>Average FPS : </b> {averageFPS} <br/>