Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it available for .NET console applications #121

Closed
aka-sabha opened this issue Dec 21, 2015 · 4 comments
Closed

Make it available for .NET console applications #121

aka-sabha opened this issue Dec 21, 2015 · 4 comments

Comments

@aka-sabha
Copy link

I didn't find this available for .NET console applications

@bdrupieski
Copy link
Contributor

It's possible to use MiniProfiler in a console application. For example:

using System;
using System.Threading;
using StackExchange.Profiling;

namespace ProfiledConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            MiniProfiler.Settings.ProfilerProvider = new SingletonProfilerProvider();
            MiniProfiler.Start("Console app");
            using (MiniProfiler.Current.Step("some work"))
            {
                Thread.Sleep(300);

                using (MiniProfiler.Current.Step("more work"))
                {
                    Thread.Sleep(200);
                }
            }

            // MACHINENAME at MM/DD/YYYY HH:MM:SS AM/PM
            //  Console app = ms
            // > some work = 501.2ms
            // >> more work = 201.1ms
            Console.WriteLine(MiniProfiler.Current.RenderPlainText());
        }
    }
}

Is this what you're looking for?

@eddiegroves
Copy link

While I'm not the OP, this was exactly what I was after, cheers.

@NickCraver
Copy link
Member

Closing this out as it is supported :)

@iquirino
Copy link

iquirino commented Nov 9, 2018

And if i want to profile Ef Core ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants