Find the answer to your Linux question:
Results 1 to 2 of 2
Kernel version 2.4.21-4.ELsmp Red Hat Enterprise Linux ES release 3 (Taroon) Using NPTL I want to calculate the cpu-time of a function in a thread. I tryed using ss << ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2005
    Posts
    1

    Get CPU Usage


    Kernel version 2.4.21-4.ELsmp
    Red Hat Enterprise Linux ES release 3 (Taroon)

    Using NPTL
    I want to calculate the cpu-time of a function in a thread.

    I tryed using
    ss << "/proc/self/task/" &l;t< gettid() << "/stat";
    fd = open(ss.str().c_str(), O_RDONLY);
    But there is no such folder task under self

    I tryed using
    pthread_getcpuclockid(pthread_self(),&clock_id);
    clock_gettime(clock_id,&ts);

    I get undefined symbol: clock_gettime

    Please help
    Thanks :?:

  2. #2
    Linux Guru budman7's Avatar
    Join Date
    Oct 2004
    Location
    Knee deep in Grand Rapids, Michigan
    Posts
    3,242
    Does "top" give you the info that you are looking for.
    How to know if you are a geek.
    when you respond to "get a life!" with "what's the URL?"
    - Birger

    New users read The FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •