jimingham wrote:

> On Apr 16, 2024, at 5:17 PM, Fred Grim ***@***.***> wrote:
> 
> 
> These seem like fairly POSIX-y bits of data, is there not a Posix way to get 
> these (so other posix systems will also get this info?)
> 
> Not that I know of for arbitrary processes in linux. fwiw the original code 
> without these values got similar bits out of the proc filesystem
> 
That's sad, but not your doing...

> Also, it looks like you added user time and system time information, but you 
> didn't test that those get valid values.
> 
> I did not. My concern here is that this would make for flaky tests. The issue 
> is that these times are going to be very dependent on the cpus they are 
> scheduled to, what else is running on that same machine and so on. I guess we 
> could do a bunch of stuff to pin the unit test process in place and make it 
> more controllable but that tends to imply permissions for the host executing 
> the unit test. Or maybe you were thinking of another way? I am all ears if so.
> 

The user and system times should be monotonically increasing.  So you could 
stop at a breakpoint, fetch the times, then run your program through a little 
spin loop to burn some CPU before hitting a second breakpoint.   Then get the 
times again and assert that they are > the first set. You could also set a 
timer in the test between the first and second stop and assert that the 
difference in system and user time is less than or equal to the timer 
difference.  A single threaded program can only run on one core at a time, so 
that should always be true.

Jim


> —
> Reply to this email directly, view it on GitHub 
> <https://github.com/llvm/llvm-project/pull/88995#issuecomment-2060104421>, or 
> unsubscribe 
> <https://github.com/notifications/unsubscribe-auth/ADUPVW7GXMVBDHR6FEXC2DLY5W5QJAVCNFSM6AAAAABGKEUICSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRQGEYDINBSGE>.
> You are receiving this because you are on a team that was mentioned.
> 



https://github.com/llvm/llvm-project/pull/88995
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to