Thread: Measure Time spent in thread context switch

  1. #1
    Registered User
    Join Date
    Feb 2014
    Posts
    7

    Measure Time spent in thread context switch

    Hi,

    I want to measure time spent in thread context switch ,how I can do that in c ,any tips?

    Thanks
    N.A.S

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    C says nothing about threads (well, C11 does -- but generally speaking, C is thread/OS agnostic). Thread and timing capabilities are OS dependent, so it really depends on your system/setup as to how you would do this or whether you even could. For example, C runs on many embedded OSes that don't support threads or timing with any precision. Care to tell us more about your situation? Hardware, OS, C implementation (compiler/libraries), what you intend to do with this info?

  3. #3
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Hey, stop switching threading contexts!

  4. #4
    Registered User
    Join Date
    Feb 2014
    Posts
    7
    Quote Originally Posted by anduril462 View Post
    C says nothing about threads (well, C11 does -- but generally speaking, C is thread/OS agnostic). Thread and timing capabilities are OS dependent, so it really depends on your system/setup as to how you would do this or whether you even could. For example, C runs on many embedded OSes that don't support threads or timing with any precision. Care to tell us more about your situation? Hardware, OS, C implementation (compiler/libraries), what you intend to do with this info?
    I want to write c code , creating two threads and see how long context switch takes.. I think we can use lock& unlock - don't know how exactly?
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Context Switch benchmark for real time linux.
    By odysseas in forum C Programming
    Replies: 5
    Last Post: 05-26-2011, 11:45 AM
  2. measure run time?
    By Tool in forum C Programming
    Replies: 14
    Last Post: 12-19-2009, 07:56 AM
  3. measure time complexity
    By l2u in forum C++ Programming
    Replies: 1
    Last Post: 11-14-2008, 08:07 AM
  4. Measure time
    By anirban in forum C Programming
    Replies: 5
    Last Post: 06-12-2008, 03:53 AM
  5. trouble to measure time with time.h
    By kobra_swe in forum C Programming
    Replies: 3
    Last Post: 08-12-2006, 08:43 AM