Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
skprog19107yOk so because of Microsoft threads turn on and off as much as the os deems needed. So thread A would have to keep track of its own run time by out putting info or using a timer. Threads b c and d can take over multiple times while its trying to run.
So time for completion? or time for total run cycles?
And what language are you using? -
So my initial question was centered more around Java, which doesn't use Threads like the OS level. The JVM scheduler manages their priority to maintian "fairness". That's my understand at least, which could be wrong.
I want to know only the time spent by thread A on it's execution. B,D,C,etc. could take 6 years, but if A takes 4 seconds I want to get that value not 6y4s. -
skprog19107ySo completion time. How long the thread takes to complete over all. I think this https://docs.oracle.com/javase/... the thread while loop at the bottom of that page.
-
@skprog So the example is very useful. It doesn't quite express what I'm after. I want to record the time arbitrarily within a multi-thread environment, so joining may not be viable being it only happens between 2 threads.
Does that make sense? Let me know if I'm not being clear. -
skprog19107yHave to track each thread individually. For what you said you want completion times for each individual thread. Use this callback while alive code. https://stackoverflow.com/questions...
-
skprog19107yDon't take my advice though i am not sure because i have never tried to time a thread. I just try to run them. Its hard enough just running multiple threads. Specifically when they may touch the same info. Lol
Related Rants
Is it possible to record the time a thread spends processing only it's code?
E.g. capture sys.ms in thread A -> A is sliced and thread B runs -> B is sliced -> A comes back and captures current sys.ms. The resulting delta of Anow - Ainit includes the time that B spent on the machine.
Is it possible to account for this and get just the time A spent processing?
Is this doable on any other languages?
If it is or isn't, any documentation or papers explain why is appreciated. Google is flooded with "how to time" questions so I'm not seeing any answer for this.
question
java
time management
windows
threading
multithreading
performance
timing