Article View: es.comp.os.linux.programacion
Article #1131Re: medir tiempo de ejecucion de un proceso
From: gamo
Date: Tue, 14 Mar 2006 11:55
Date: Tue, 14 Mar 2006 11:55
68 lines
2455 bytes
2455 bytes
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--8323328-2060731837-1142337354=:20330
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE
On Tue, 13 Mar 2006, alejogf@gmail.com wrote:
> buenas tardes tengo un problema, tengo que hacer un programa que mida
> el tiempo de ejecucion de un proceso(cualquiera)
>=20
> hasta ahora llevo
>=20
> #include <stdio.h>
> #include <time.h>
> #define CLOCKS_PER_SEC 1000.0
Problema:
CONFORMING TO
ANSI C. POSIX requires that CLOCKS_PER_SEC equals 1000000=20
independent of the
actual resolution.
man clock
> int main( void )
> {
> long int i=3D0;
> clock_t comienzo;
>=20
> comienzo=3Dclock();
^---------------
COMIENZA A MEDIR DESDE AQUI
> for( i=3D0; i<10000; i++ ) printf( "-" )
=BFY que pinta ese printf ah=ED, fuera del bucle y sin ; ?
=BFNo ser=E1 for (i=3D0; i<10000; i++, printf("-") ) ?
> {
> /* supongo que dentro de este bucle deberia ir el proceso pero esa es
> la duda que tengo*/
No, puesto as=ED lo que se mide incluye tambi=E9n al bucle y 10000 veces el=
=20
proceso.
> }
> printf( "tiempo transcurrido desde el inicio del proceso: %f s\n",
> (clock()-comienzo)/(double)CLOCKS_PER_SEC );
^---------------
HASTA AQUI
>=20
> return 0;
> }
>=20
>=20
> les recomendaria la ayuda mil gracias
>=20
>=20
--8323328-2060731837-1142337354=:20330--
Technical Details
Message-ID:
<Pine.LNX.4.64.0603141243450.20330@jvz.es>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.telecable.es!cm-83-97-181-149.telecable.es!amoReferences:
<1142318298.429488.274930@e56g2000cwe.googlegroups.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,a4ba6f3038af4e80 X-Google-Attributes: gidf86c8,public X-Google-Language: SPANISH,ASCII Newsgroups: es.comp.os.linux.programacion Date: Tue, 14 Mar 2006 12:55:54 +0100 From: gamo <gamo@telecable.es> X-X-Sender: amo@jvz.es Reply-To: gamo@telecable.es Subject: Re: medir tiempo de ejecucion de un proceso In-Reply-To: <1142318298.429488.274930@e56g2000cwe.googlegroups.com> Message-ID: <Pine.LNX.4.64.0603141243450.20330@jvz.es> References: <1142318298.429488.274930@e56g2000cwe.googlegroups.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-2060731837-1142337354=:20330" NNTP-Posting-Host: 83.97.181.149 X-Trace: filemon2.isp.telecable.es 1142337300 83.97.181.149 (14 Mar 2006 12:55:00 +0100) Organization: TeleCable, S.A.U. Lines: 68 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.telecable.es!cm-83-97-181-149.telecable.es!amo