Maoni0 / realmon

A monitoring tool that tells you when GCs happen in a process and some characteristics about these GCs
MIT License
281 stars 25 forks source link

Got Linux support working to complete #7 #9

Closed MokoSan closed 2 years ago

MokoSan commented 2 years ago

Got Linux support working to complete https://github.com/Maoni0/realmon/issues/7:

How to Run realmon on Linux

To run realmon in Linux using the command line:

cd into the realmon\windows directory and run:

dotnet run -- -n <Name of Process>

or

dotnet run -- -p <Process Id>

Result

image

Testing Details

Dotnet Version Details

mokosan:% dotnet --version
5.0.102

Linux Distro + Version Details

mokosan:% lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal
MokoSan commented 2 years ago

As a follow up to this PR, we should move the code out of the windows dir. This repo was seemingly provisioned to build on Linux since inception.

Also, writing this code up and getting this working on my Linux machine was such a great feeling!

As for the testing on a dotnet process, I created a simple Console App that continually GC'd:

        static List<Obj> objs= new List<Obj>();
        public class Obj
        {
            byte[] bigArray1 = new byte[1024];
            byte[] bigArray2 = new byte[1024];
            byte[] bigArray3 = new byte[1024];
            byte[] bigArray4 = new byte[1024];
            byte[] bigArray5 = new byte[1024];
        }

        static void Main(string[] args)
        {
            Console.WriteLine($"This process: {Process.GetCurrentProcess().Id}");
            while (true)
            {
                int[] intArr = new int[1000];
                Obj obj = new Obj();
                objs.Add(new Obj());
                GC.Collect();
                Thread.Sleep(1000);
                Console.WriteLine("Hello World!");
            }
        }
Maoni0 commented 2 years ago

this looks great! thanks for doing this. yes, now that I know you can actually use .sln on linux the first part of issue #7 was not needed :)