forked from LLNL/Caliper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci_test_f_ann.f
63 lines (45 loc) · 1.53 KB
/
ci_test_f_ann.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
program fortran_example
use caliper_mod
implicit none
type(Annotation) :: g_ann
type(ScopeAnnotation) :: f_ann, w_ann
type(ConfigManager) :: mgr
integer :: i, count, argc, prop
logical :: ret
character(:), allocatable :: spec
character(len=:), allocatable :: errmsg
character(len=256) :: arg
spec = '{ "name" : "custom-trace-spec", &
& "categories" : [ "output" ], &
& "services" : [ "event", "trace", "recorder" ] &
&}'
call cali_init()
mgr = ConfigManager_new()
call mgr%add_config_spec(spec)
argc = command_argument_count()
if (argc .ge. 1) then
call get_command_argument(1, arg)
call mgr%add(arg)
ret = mgr%error()
if (ret) then
errmsg = mgr%error_msg()
write(*,*) 'ConfigManager: ', errmsg
endif
endif
call mgr%start
f_ann = ScopeAnnotation_begin('main')
w_ann = ScopeAnnotation_begin('work')
call cali_set_global_int_byname('global.int.1', 42)
prop = IOR(CALI_ATTR_GLOBAL, CALI_ATTR_ASVALUE)
g_ann = Annotation_new_with_properties('global.int.2', prop)
call g_ann%set_int(84)
call Annotation_delete(g_ann)
call ScopeAnnotation_end(w_ann)
call cali_begin_region('foo')
call cali_end_region('foo')
call cali_begin_phase('bar')
call cali_end_phase('bar')
call ScopeAnnotation_end(f_ann)
call mgr%flush
call ConfigManager_delete(mgr)
end program fortran_example