# Getting access to run time of a process from Ruby, as opposed to wall clock time

**URL:** <https://www.ruby-forum.com/t/getting-access-to-run-time-of-a-process-from-ruby-as-opposed-to-wall-clock-time/131218>\
**Category:** Ruby\
**Created:** [March 7, 2008, 12:22am UTC](https://www.ruby-forum.com/t/getting-access-to-run-time-of-a-process-from-ruby-as-opposed-to-wall-clock-time/131218 "2008-03-07T00:22:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 7, 2008, 12:22am UTC](https://www.ruby-forum.com/t/getting-access-to-run-time-of-a-process-from-ruby-as-opposed-to-wall-clock-time/131218/1 "2008-03-07T00:22:28Z")

</div>

The C runtime for POSIX includes a clock() function that gives you the  
amount of time that your process has actually had on the CPU. I’ve  
googled for a way to get access to this from Ruby, and all I get is  
the fact that rubyprof uses this in its implementation. Is there a  
way to get at this or something equivalent from Ruby without having to  
write a C extension?

Thanks.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 7, 2008, 12:39am UTC](https://www.ruby-forum.com/t/getting-access-to-run-time-of-a-process-from-ruby-as-opposed-to-wall-clock-time/131218/2 "2008-03-07T00:39:29Z")

</div>

removed\_email\_address@domain.invalid wrote:

> The C runtime for POSIX includes a clock() function that gives you the  
> amount of time that your process has actually had on the CPU. I’ve  
> googled for a way to get access to this from Ruby, and all I get is  
> the fact that rubyprof uses this in its implementation. Is there a  
> way to get at this or something equivalent from Ruby without having to  
> write a C extension?

Process.times ?
