Measure Time spent in thread context switch

This is a discussion on Measure Time spent in thread context switch within the Linux Programming forums, part of the Platform Specific Boards category; Hi, I want to measure time spent in thread context switch ,how I can do that in c ,any tips? ...

  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,676
    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
    1,279
    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, 12:45 PM
  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, 04:53 AM
  5. trouble to measure time with time.h
    By kobra_swe in forum C Programming
    Replies: 3
    Last Post: 08-12-2006, 09:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21