Module: BOAST::TimerProbe
Constant Summary
collapse
- RESULT =
BOAST::Int( "_boast_duration", :size => 8 )
Class Method Summary
collapse
address_size, address_size=, annotate, annotate=, annotate?, annotate_indepth_list, annotate_indepth_list=, annotate_level, annotate_level=, annotate_list, annotate_list=, architecture, architecture=, array_start, array_start=, chain_code, chain_code=, chain_code?, debug, debug=, debug?, debug_kernel_source, debug_kernel_source=, debug_kernel_source?, debug_source, debug_source=, debug_source?, decl_module, decl_module=, decl_module?, default_align, default_align=, default_int_signed, default_int_signed=, default_int_signed?, default_int_size, default_int_size=, default_real_size, default_real_size=, default_type, default_type=, disable_openmp, disable_openmp=, disable_openmp?, executable, executable=, executable?, ffi, ffi=, ffi?, fortran_line_length, fortran_line_length=, get_address_size, get_annotate, get_annotate_indepth_list, get_annotate_level, get_annotate_list, get_architecture, get_array_start, get_chain_code, get_debug, get_debug_kernel_source, get_debug_source, get_decl_module, get_default_align, get_default_int_signed, get_default_int_size, get_default_real_size, get_default_type, get_disable_openmp, get_executable, get_ffi, get_fortran_line_length, get_indent_increment, get_indent_level, get_keep_temp, get_lang, get_model, get_optimizer_log, get_optimizer_log_file, get_output, get_replace_constants, get_synchro, get_use_vla, get_verbose, indent_increment, indent_increment=, indent_level, indent_level=, keep_temp, keep_temp=, keep_temp?, lang, lang=, model, model=, optimizer_log, optimizer_log=, optimizer_log?, optimizer_log_file, optimizer_log_file=, output, output=, replace_constants, replace_constants=, replace_constants?, set_address_size, set_annotate, set_annotate_indepth_list, set_annotate_level, set_annotate_list, set_architecture, set_array_start, set_chain_code, set_debug, set_debug_kernel_source, set_debug_source, set_decl_module, set_default_align, set_default_int_signed, set_default_int_size, set_default_real_size, set_default_type, set_disable_openmp, set_executable, set_ffi, set_fortran_line_length, set_indent_increment, set_indent_level, set_keep_temp, set_lang, set_model, set_optimizer_log, set_optimizer_log_file, set_output, set_replace_constants, set_synchro, set_use_vla, set_verbose, synchro, synchro=, use_vla, use_vla=, use_vla?, verbose, verbose=, verbose?
Class Method Details
.compute ⇒ Object
119
120
121
|
# File 'lib/BOAST/Runtime/Probe.rb', line 119
def compute
get_output.puts " _boast_timer_compute(&_boast_params._boast_timer);"
end
|
108
109
|
# File 'lib/BOAST/Runtime/Probe.rb', line 108
def configure
end
|
.decl ⇒ Object
104
105
106
|
# File 'lib/BOAST/Runtime/Probe.rb', line 104
def decl
get_output.print " struct _boast_timer_struct _boast_timer;\n"
end
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/BOAST/Runtime/Probe.rb', line 19
def
if OS.mac? then
get_output.print "#if __cplusplus\nextern \"C\" {\n#endif\n#include <mach/mach_time.h>\n#if __cplusplus\n}\n#endif\n"
else
get_output.print "#include <time.h>\n"
end
end
|
.ldflags ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/BOAST/Runtime/Probe.rb', line 11
def ldflags
if OS.mac? then
""
else
"-lrt"
end
end
|
.preamble ⇒ Object
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/BOAST/Runtime/Probe.rb', line 35
def preamble
get_output.print "struct _boast_timer_struct {\n"
if OS.mac? then
get_output.print " uint64_t start, stop;\n mach_timebase_info_data_t timebase_info;\n"
else
get_output.print " struct timespec start, stop;\n"
end
push_env(:indent_level => 2) {
BOAST::decl RESULT
}
get_output.print "};\n\nstatic inline void _boast_timer_start(struct _boast_timer_struct * _boast_timer) {\n"
if OS.mac? then
get_output.print " _boast_timer->start = mach_absolute_time();\n"
else
get_output.print " clock_gettime(CLOCK_REALTIME, &_boast_timer->start);\n"
end
get_output.print "}\n\nstatic inline void _boast_timer_stop(struct _boast_timer_struct * _boast_timer) {\n"
if OS.mac? then
get_output.print " _boast_timer->stop = mach_absolute_time();\n"
else
get_output.print " clock_gettime(CLOCK_REALTIME, &_boast_timer->stop);\n"
end
get_output.print "}\n\nstatic inline void _boast_timer_compute(struct _boast_timer_struct * _boast_timer) {\n"
if OS.mac? then
get_output.print " mach_timebase_info(&_boast_timer->timebase_info);\n"
get_output.print " _boast_timer->#{RESULT} = (_boast_timer->stop - _boast_timer->start) * _boast_timer->timebase_info.numer / _boast_timer->timebase_info.denom;\n"
else
get_output.print " _boast_timer->#{RESULT} = (int64_t)(_boast_timer->stop.tv_sec - _boast_timer->start.tv_sec) * 1000000000ll + _boast_timer->stop.tv_nsec - _boast_timer->start.tv_nsec;\n"
end
get_output.print "}\n\n#ifdef RUBY\nstatic inline void _boast_timer_store(struct _boast_timer_struct * _boast_timer, VALUE _boast_stats) {\n"
get_output.puts " rb_hash_aset(_boast_stats,ID2SYM(rb_intern(\"duration\")),rb_float_new((double)_boast_timer->#{RESULT}*(double)1e-9));"
if OS.mac? then
get_output.puts " rb_hash_aset(_boast_stats,ID2SYM(rb_intern(\"start\")),rb_int_new((int64_t)(_boast_timer->start * _boast_timer->timebase_info.numer / _boast_timer->timebase_info.denom)*1000000000ll));"
get_output.puts " rb_hash_aset(_boast_stats,ID2SYM(rb_intern(\"end\")),rb_int_new((int64_t)(_boast_timer->stop * _boast_timer->timebase_info.numer / _boast_timer->timebase_info.denom)*1000000000ll));"
else
get_output.puts " rb_hash_aset(_boast_stats,ID2SYM(rb_intern(\"start\")),rb_int_new((int64_t)_boast_timer->start.tv_sec * 1000000000ll+_boast_timer->start.tv_nsec));"
get_output.puts " rb_hash_aset(_boast_stats,ID2SYM(rb_intern(\"end\")),rb_int_new((int64_t)_boast_timer->stop.tv_sec * 1000000000ll+_boast_timer->stop.tv_nsec));"
end
get_output.print "}\n#endif\n\n"
end
|
.start ⇒ Object
111
112
113
|
# File 'lib/BOAST/Runtime/Probe.rb', line 111
def start
get_output.puts " _boast_timer_start(&_boast_params._boast_timer);"
end
|
.stop ⇒ Object
115
116
117
|
# File 'lib/BOAST/Runtime/Probe.rb', line 115
def stop
get_output.puts " _boast_timer_stop(&_boast_params._boast_timer);"
end
|
.store ⇒ Object
123
124
125
|
# File 'lib/BOAST/Runtime/Probe.rb', line 123
def store
get_output.puts " _boast_timer_store(&_boast_params._boast_timer, _boast_stats);"
end
|
.to_yaml ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/BOAST/Runtime/Probe.rb', line 127
def to_yaml
get_output.print " printf(\":duration: %lf\\\\n\", (double)_boast_params._boast_timer.\#{RESULT}*(double)1e-9);\n"
if OS.mac? then
get_output.puts " printf(\":start: %lld\\n\",(int64_t)(_boast_params._boast_timer.start * _boast_params._boast_timer.timebase_info.numer / _boast_params._boast_timer.timebase_info.denom)*1000000000ll);"
get_output.puts " printf(\":end: %lld\\n\",(int64_t)(_boast_params._boast_timer.stop * _boast_params._boast_timer.timebase_info.numer / _boast_params._boast_timer.timebase_info.denom)*1000000000ll);"
else
get_output.puts " printf(\":start: %lld\\n\",(int64_t)_boast_params._boast_timer.start.tv_sec * 1000000000ll+_boast_params._boast_timer.start.tv_nsec);"
get_output.puts " printf(\":end: %lld\\n\",(int64_t)_boast_params._boast_timer.stop.tv_sec * 1000000000ll+_boast_params._boast_timer.stop.tv_nsec);"
end
end
|