Article View: es.comp.os.linux.programacion
Article #15254Re: tiempo CPU
From: Mauricio
Date: Sun, 23 Jul 2000 00:00
Date: Sun, 23 Jul 2000 00:00
78 lines
3410 bytes
3410 bytes
monica escribi�:
m> Necesito saber si hay alguna manera de conocer el tiempo de CPU que
m> consume un determinado proceso, independientemente del total de CPU que
m> est� siendo utilizado en ese miomento, si por ej, est�s corriendo m�s
m> progamas al mismo tiempo. He probado con 'time' pero parece que no es
m> �ste... Supongo que esta pregunta se puede extender a Unix ;-), la
m> respuesta tambi�n me vale...
Parece que hay dos comandos time, uno interno (built-in) del bash y
otro externo (supongo que �ste ser� m�s o menos est�ndar en unix).
La ayuda del primero la puedes consultar con "help time". Por lo que
veo es muy elemental, pero quiz� te sirva:
makoki:~$ time help time
time: time [-p] PIPELINE
Execute PIPELINE and print a summary of the real time, user CPU time,
and system CPU time spent executing PIPELINE when it terminates.
The return status is the return status of PIPELINE. The `-p' option
prints the timing summary in a slightly different format. This uses
the value of the TIMEFORMAT variable as the output format.
real 0m0.001s
user 0m0.000s
sys 0m0.000s
El segundo viene en un paquete independiente en Debian. Tiene su propia
p�gina de manual. Ojo: inv�calo especificando el path del ejecutable:
makoki:~$ /usr/bin/time man time
TIME(1) TIME(1)
NAME
time - run programs and summarize system resource usage
SYNOPSIS
time [ -apqvV ] [ -f FORMAT ] [ -o FILE ]
[ --append ] [ --verbose ] [ --quiet ] [
--portability ]
[ --format=FORMAT ] [ --output=FILE ] [ --version ]
[ --help ] COMMAND [ ARGS ]
[...]
0.04user 0.06system 0:01.79elapsed 5%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (1027major+280minor)pagefaults 0swaps
La descripci�n del paquete para Debian es esta:
makoki:~$ dpkg -s time
Package: time
Status: install ok installed
Priority: standard
Section: utils
Installed-Size: 63
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Version: 1.7-9
Depends: libc6 (>= 2.1.2)
Description: The GNU time command.
The `time' command runs another program, then displays information
about the resources used by that program, collected by the system while
the program was running. You can select which information is reported
and the format in which it is shown, or have `time' save the information
in a file instead of display it on the screen.
.
The resources that `time' can report on fall into the general
categories of time, memory, I/O, and IPC calls.
.
The GNU version can format the output in arbitrary ways by using a
printf-style format string to include various resource measurements.
Saludos.
--
Debian GNU/Linux
Technical Details
Message-ID:
<brbdl8.pfm.ln@127.0.0.1>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<39784C9F.D6CB2E08@bi.ehu.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,9a94eb7b51b236e5
X-Google-Attributes: gidf86c8,public
From: Mauricio <tas@subdimension.com>
Subject: Re: tiempo CPU
Date: 2000/07/23
Message-ID: <brbdl8.pfm.ln@127.0.0.1>
X-Deja-AN: 649614603
Distribution: es
Content-Transfer-Encoding: 8bit
References: <39784C9F.D6CB2E08@bi.ehu.es>
Content-Type: text/plain; charset=ISO-8859-1
Organization: Bits & Bobs Inc.
Mime-Version: 1.0
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (Linux/2.2.16 (i586))
Newsgroups: es.comp.os.linux.programacion