<< Chapter < Page Chapter >> Page >

Prof

prof es la herramienta de perfilado más común en UNIX. En cierto sentido, es una extensión del compilador, enlazador y de las bibliotecas de código objeto, más unas pocas utilidades extras, de forma que es difícil hallar una sola cosa y decir "esto es lo que perfila su código.” prof trabaja muestreando periódicamente el contador de programa conforme se ejecuta su aplicación. Para permitir el perfilado, usted debe recompilarla y re-enlazarla usando la bandera –p . Por ejemplo, si su programa tiene dos módulos, stuff.c y junk.c , requiere compilar y enlazar de acuerdo al código siguiente:


% cc stuff.c -p -O -c % cc junk.c -p -O -c% cc stuff.o junk.o -p -o stuff

Esto crea un binario stuff que está listo para el perfilado. Usted no requiere hacer nada especial para ejecutarlo. Sólo trátelo normalmente, tecleando stuff . Como se están recolectando las estadísticas a tiempo de ejecución, toma un poco más de lo usual en ejecutarse. Recuerde: el código con el perfilado activo toma más en ejecutarse. Debe recompilar y re-enlazar el programa completo sin la bandera –p cuando haya finalizado el perfilado. Una vez completado, habrá un nuevo archivo llamado mon.out en el directorio donde lo ejecutó. Este archivo contiene la historia de stuff en forma binaria, así que no puede observarla directamente. Use la utilidad prof para leer mon.out y crear un perfil de stuff . Por defecto, la información se escribe a su pantalla porque es la salida estándar, aunque puede redirigirla fácilmente a un archivo:


% prof stuff>stuff.prof

Para poder explorar cómo funciona el comando prof , hemos creado la siguiente aplicación, bucles.c , que es pequeña y ridícula. Contiene una rutina principal y tres subrutinas para las cuáles puede usted predecir la distribución de tiempo, con sólo observar el código.


main () { int l;for (l=0;l<1000;l++) { if (l == 2*(l/2)) foo ();bar(); baz();} }foo (){ int j;for (j=0;j<200;j++) }bar () { int i;for (i=0;i<200;i++); }baz () { int k;for (k=0;k<300;k++); }

Nuevamente, debe compilar y enlazar bucles con la bandera –p , ejecutar el programa, y luego ejecutar la utilidad prof para extraer un perfil, tal como sigue:


% cc bucles.c -p -o bucles % ./bucles% prof bucles>bucles.prof

El siguiente ejemplo muestra cómo debe verse bucles.prof . Hay seis columnas.


%Time Seconds Cumsecs #Calls msec/call Name 56.80.50 0.50 1000 0.500 _baz 27.3 0.24 0.74 1000 0.240 _bar15.9 0.14 0.88 500 0.28 _foo 0.0 0.00 0.88 1 0. _creat0.0 0.00 0.88 2 0. _profil 0.0 0.00 0.88 1 0. _main0.0 0.00 0.88 3 0. _getenv 0.0 0.00 0.88 1 0. _strcpy0.0 0.00 0.88 1 0. _write

Las columnas pueden describirse como sigue:

  • %Time Porcentaje de tiempo de CPU consumido por esta rutina
  • Seconds Tiempo de CPU consumido por esta rutina
  • Cumsecs Un acumulado del tiempo consumida por esta rutina y todas las que la preceden en la lista
  • Calls El número de veces que fue llamada esta rutina en particular
  • msec/call Segundos divididos entre el número de llamadas, dando el promedio de tiempo tomado por cada invocación de la rutina
  • Name El nombre de esta rutina

Questions & Answers

what is mutation
Janga Reply
what is a cell
Sifune Reply
how is urine form
Sifune
what is antagonism?
mahase Reply
classification of plants, gymnosperm features.
Linsy Reply
what is the features of gymnosperm
Linsy
how many types of solid did we have
Samuel Reply
what is an ionic bond
Samuel
What is Atoms
Daprince Reply
what is fallopian tube
Merolyn
what is bladder
Merolyn
what's bulbourethral gland
Eduek Reply
urine is formed in the nephron of the renal medulla in the kidney. It starts from filtration, then selective reabsorption and finally secretion
onuoha Reply
State the evolution relation and relevance between endoplasmic reticulum and cytoskeleton as it relates to cell.
Jeremiah
what is heart
Konadu Reply
how is urine formed in human
Konadu
how is urine formed in human
Rahma
what is the diference between a cavity and a canal
Pelagie Reply
what is the causative agent of malaria
Diamond
malaria is caused by an insect called mosquito.
Naomi
Malaria is cause by female anopheles mosquito
Isaac
Malaria is caused by plasmodium Female anopheles mosquitoe is d carrier
Olalekan
a canal is more needed in a root but a cavity is a bad effect
Commander
what are pathogens
Don Reply
In biology, a pathogen (Greek: πάθος pathos "suffering", "passion" and -γενής -genēs "producer of") in the oldest and broadest sense, is anything that can produce disease. A pathogen may also be referred to as an infectious agent, or simply a germ. The term pathogen came into use in the 1880s.[1][2
Zainab
A virus
Commander
Definition of respiration
Muhsin Reply
respiration is the process in which we breath in oxygen and breath out carbon dioxide
Achor
how are lungs work
Commander
where does digestion begins
Achiri Reply
in the mouth
EZEKIEL
what are the functions of follicle stimulating harmones?
Rashima Reply
stimulates the follicle to release the mature ovum into the oviduct
Davonte
what are the functions of Endocrine and pituitary gland
Chinaza
endocrine secrete hormone and regulate body process
Achor
while pituitary gland is an example of endocrine system and it's found in the Brain
Achor
what's biology?
Egbodo Reply
Biology is the study of living organisms, divided into many specialized field that cover their morphology, physiology,anatomy, behaviour,origin and distribution.
Lisah
biology is the study of life.
Alfreda
Biology is the study of how living organisms live and survive in a specific environment
Sifune
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Cómputo de alto rendimiento. OpenStax CNX. Sep 02, 2011 Download for free at http://cnx.org/content/col11356/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Cómputo de alto rendimiento' conversation and receive update notifications?

Ask