-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi Mike,
Thank you for the awesome library!
In my test, sudo can read stats just fine, but I'm getting null from LinuxTaskStatsReader.GetByThread when running without elevated permissions.
Code:
var tid = LinuxTaskStatsReader.GetTid();
Console.WriteLine("Tid = " + tid);
Console.WriteLine("IsGetTaskStatByThreadSupported = " + LinuxTaskStatsReader.IsGetTaskStatByThreadSupported);
Console.WriteLine("Stats = " + LinuxTaskStatsReader.GetByThread(tid));
Output:
~/dev/sandbox/Sandbox$ dotnet run
Tid = 726
IsGetTaskStatByThreadSupported = True
Stats = null
All I need is to get CPU time by thread, similar to what you other package CpuUsage does via libc getrusage. But I had to switch to NativeLinux.Interop because I want to read thead's CPU from another thread, so I need a function which accepts thread id/handle, not the one which only runs on the current thread.
Is there a more simple solution for my case maybe, which doesn't require elevated permissions? I'm not good at linux api unfortunately...
PS: I tested it on Ubuntu 22.04.1 LTS on WSL, but it doesn't seem to be version-specific.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels