LLVM OpenMP
control_tool_before_directive.c
Go to the documentation of this file.
1// clang-format off
2// RUN: %libomp-compile-and-run | FileCheck %s
3// REQUIRES: ompt
4// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
5// clang-format on
6#define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN
7#include "callback.h"
8#include <omp.h>
9#include <stdio.h>
10
11int main() {
12 int result = omp_control_tool(omp_control_tool_flush, 1, NULL);
13 printf("control_tool result = %d\n", result);
14
15#pragma omp parallel num_threads(1)
16 {
17 print_frame_from_outlined_fn(1);
18 print_frame(0);
20 }
21
22 result = omp_control_tool(omp_control_tool_flush, 1, NULL);
23 printf("control_tool result = %d\n", result);
24
25 // clang-format off
26
27 // Check if libomp allows interacting with an attached tool both before and after the first
28 // directive is being used.
29
30 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_control_tool'
31
32 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
33
34 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_control_tool: command=3, modifier=1, arg=[[NULL]], codeptr_ra={{(0x)?[0-f]*}}, current_task_frame.exit={{.*}}, current_task_frame.reenter={{(0x)?[0-f]*}}
35 // CHECK-NEXT: control_tool result = 0
36
37 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_control_tool: command=3, modifier=1, arg=[[NULL]], codeptr_ra={{(0x)?[0-f]*}}, current_task_frame.exit={{.*}}, current_task_frame.reenter={{(0x)?[0-f]*}}
38 // CHECK-NEXT: control_tool result = 0
39
40 // clang-format on
41
42 return 0;
43}
#define print_frame(level)
Definition callback.h:210
#define print_current_address(id)
Definition callback.h:255
int result[2]