Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!tut.cis.ohio-state.edu!stegosaur.cis.ohio-state.edu!john_r_mudd From: john_r_mudd@stegosaur.cis.ohio-state.edu Newsgroups: comp.os.mach Subject: Timing C Threads Message-ID: <78609@tut.cis.ohio-state.edu> Date: 29 Mar 90 16:50:31 GMT Sender: usenet_news@tut.cis.ohio-state.edu Reply-To: John R. Mudd Organization: The Ohio State University Dept. of Computer & Information Science Lines: 26 Does anyone have any suggestions on how to time the context switch of C Threads (not kernel threads)? I don't think timing a cthread_yield() call is a good idea, because I'd guess that the primitive is a no-op unless there are other threads available for execution. Currently, I'm measuring the difference between one thread signalling another thread, and the other thread waking up, e.g. thread 1 thread 2 condition_wait(switchsig,lock) t0 = timer() t1 = timer() condition_signal(switchsig) Care is taken to ensure that thread 1 executes the wait before the thread 2 signals. Time to wakeup a thread would equal (t1-t0). Any thoughts/comments/suggestions? ... John .......................................................................... John R. Mudd jrm@cis.ohio-state.edu Department of Computer and Information Science, The Ohio State University 2036 Neil Avenue, Columbus, Ohio, USA 43210-1277