Re: SOS-About pthead_create() and pthread_join()
From: Martin Blume (mblume_at_socha.net)
Date: 08/29/03
- Next message: TelkomNews: "Using devfs to address device driver"
- Previous message: Tim Cambrant: "Re: Compiling kernels under RedHat-9.0"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Aug 2003 09:26:50 +0200
"Aaron" <coldhouse@163.com> schrieb
> I want to know the time-cost on creating a thread.
> But there are some problems with it. Can someone help me?
>
> for ( i = 0; i < loop_cnt; i++ ) {
> ...
> avg = timeuse / 100;
> }
I do not know what problems you have, but at first glance I see two
problems:
- the average calculation is wrong (hint: average = sum_of_values /
number_of_values)
- you perform the loop loop_cnt times, but compute the average on
100 values. This yields correct results iff loop_cnt == 100 (hint:
hardcoded numeric values (100) instead of abstract values (#define
LOOP_CNT 100) may be a sign of trouble).
HTH
Martin
- Next message: TelkomNews: "Using devfs to address device driver"
- Previous message: Tim Cambrant: "Re: Compiling kernels under RedHat-9.0"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]