c++ - How to use boost to track real time instead of user+sys? -
I am using The output of However, if I run the code with 4 threads: It seems that tracking user + sys time is not real time. How can I track it in real time? I am using Boost 1.46. To be more specific, the timer is in the main thread, which just calls a function that ends using multiple threads. Edit: The related source looks like this: I hope the form of which output In order to print the program, I should look at the second run It appears that you If you can not use version 2 API, you can use boost :: timer to make a block of my code I run the code with a thread:
$ time ./runfoo 1 2.08s real 0m2.086s user 0m1.611s sys 0m0.475s
2.08
t.elapsed () is.
$ time. / Runfoo 4 has gone 2.47s real 0m1.022s user 0m1.834s sys 0m0.628s
Promotion :: asio :: io_service ios; Promotion: Thread_Group pool; Boost :: asio :: io_service :: Job work (ios); Pool.create_thread (boost :: bind (and boost :: aso :: io_service :: runs, & ioService)); Pool.create_thread (boost :: bind (and boost :: aso :: io_service :: runs, & ioService)); Pool.create_thread (boost :: bind (and boost :: aso :: io_service :: runs, & ioService)); Pool.create_thread (boost :: bind (and boost :: aso :: io_service :: runs, & ioService)); (Promotion: Timer T; function_which_posts_to_ios (IOS); Printf (""% .2fs taken \ n ", t.elapsed ();}
instead of "code 1.02s" to
"taken 2.47s" as
1.02s The actual amount of seconds passed was in the form.
) were not consistent in platforms, others And some CPU time-time clock time. In this,
has passed () method gives a structure that is genuine, user and specific member for system time.
boost :: posix_time instead of measuring the time of the clock. < / Html>
Comments
Post a Comment