Domain: A domain defines a name and creates a namespace for the tasks. Hence each domain can contain one or more or no task(s).
- Within a domain, task names must be unique and task names can be the same within different domains.
- (domain, task) combination is to be unique within a thread and this tuple uniquely identifies a Task Item. Same (domain, task), that is, the same task item can appear multiple times within a thread, each such appearance is called a Task Instance. Time taken by all such Task Items would be summed up in the report.
- Currently, nested domains are not allowed, that is, one domain cannot contain another domain.
Task: A task is sequence of synchronous/blocking code executed between the calls amdTaskBegin(...) and amdTaskEnd(...).
- Blocking code in the definition of the task means each instruction or function call within the task is first completed, before proceeding to the next instruction or function call. In case of thread launch, process launch or some other asynchronous call, time consumed by that thread or process or that asynchronous call is not included in the task, only the launch overhead(which contributes to the elapse time between the calls amdTaskBegin(...) and amdTaskEnd(...)) is included in the task time.
- Code executed may be different from the code listed between the calls
amdTaskBegin(...) and amdTaskEnd(...). because at runtime control may go to
different areas of the code as seen in the following example.Figure 1. Executed Code - Differences
Code listed between the calls amdTaskBegin(...) and amdTaskEnd(...) contains the sequence of instructions: Instruction 73 to Instruction 78.
But actual instructions(code) executed within that task are the following and are in the following sequence: Instruction 73, Instruction 74, Instruction 1, Instruction 2, Instruction 3, Instruction 77, Instruction 78.
- A task cannot span over multiple threads, that is, it cannot start in one thread and end in another.
- amdTaskEnd(...) takes the domain as parameter, but not a task. It closes the last open task (that is, the task created and started by last encountered amdTaskBegin(...) in the runtime) from the same domain. Hence, within a domain the behavior is like a stack, where conceptually for each domain there is a separate stack in which amdTaskBegin(...) is pushed and whenever amdTaskEnd(...) with the same domain is encountered, top of the stack is popped and combined with the current amdTaskEnd(...) to define this task-instance.
- Nested tasks are allowed, but nested domains are not allowed.
- Overlapping tasks are allowed.
- Incomplete tasks, where amdTaskBegin(...) is defined and encountered at the runtime, but amdTaskEnd(...) is not defined or not encountered at the runtime, are ignored.
- If a task-item (defined by unique combination of (domain, task) tuple) is
repeated in multiple threads of a process, then time consumed by all such
task-instances (any instance of appearance of task-item in the code; there can be
multiple appearance of same task-item even within a single thread or function) are
summed up and reported in the hotspot and per process section (added with
–detailoption).
For C++ based multi-process application, when a task-item is present in multiple
processes, Hottest Task section shows the sum of all times consumed by all
task-instances from all the processes. But, with –detail option, for
each task-items, per process sum for that task-item is reported in the Task
Summary section which is per process.