Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

prof(1)

profil(2)

monitor(3c)

prof(5)  —  RISC

Name

prof − profile within a function

Syntax

#define MARK
#include <prof.h>

void MARK (name)

Description

The symbol MARK produces a mark called name that is treated the same as a function entry point.  Execution of the mark increments the counter for that mark, and the program-counter time spent is accounted to the preceding mark or to the function if a preceding mark is not within the active function. 

The name argument can be any combination of numbers or underscores.  Each name in a single compilation must be unique, but can be the same as any ordinary program symbol. 

For marks to be effective, the symbol MARK must be defined before the header file <prof.h> is included. This may be defined by a preprocessor directive as in the synopsis, or by a command line argument.  For example:

cc −p −DMARK foo.c

If MARK is not defined, the MARK(name) statements may remain in the source files, but they will be ignored.

Examples

In the following example, marks are used to determine how much time is spent in each loop.  Unless the example is compiled with MARK defined on the command line, the marks are ignored:

#include <prof.h>
foo( )
{
int i, j;
.
.
.
MARK(loop1);
for (i = 0; i < 2000; i++) {
. . .
}
MARK(loop2);
for (j = 0; j < 2000; j++) {
. . .
}
}

See Also

prof(1), profil(2), monitor(3c)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026