1-define(FOLSOM_TABLE, folsom). 2-define(COUNTER_TABLE, folsom_counters). 3-define(GAUGE_TABLE, folsom_gauges). 4-define(HISTOGRAM_TABLE, folsom_histograms). 5-define(METER_TABLE, folsom_meters). 6-define(METER_READER_TABLE, folsom_meter_readers). 7-define(HISTORY_TABLE, folsom_histories). 8-define(DURATION_TABLE, folsom_durations). 9-define(SPIRAL_TABLE, folsom_spirals). 10 11-define(DEFAULT_LIMIT, 5). 12-define(DEFAULT_SIZE, 1028). % mimic codahale's metrics 13-define(DEFAULT_SLIDING_WINDOW, 60). % sixty second sliding window 14-define(DEFAULT_ALPHA, 0.015). % mimic codahale's metrics 15-define(DEFAULT_INTERVAL, 5000). 16-define(DEFAULT_SAMPLE_TYPE, uniform). 17 18-record(spiral, { 19 tid = folsom_metrics_histogram_ets:new(folsom_spiral, 20 [set, 21 {write_concurrency, true}, 22 public]), 23 server, 24 update = update_counter :: update_counter | 25 update_counter_no_exception 26 }). 27 28-record(slide, { 29 window = ?DEFAULT_SLIDING_WINDOW, 30 reservoir = folsom_metrics_histogram_ets:new(folsom_slide, 31 [duplicate_bag, {write_concurrency, true}, public]), 32 server 33 }). 34 35-record(slide_uniform, { 36 window = ?DEFAULT_SLIDING_WINDOW, 37 size = ?DEFAULT_SIZE, 38 reservoir = folsom_metrics_histogram_ets:new(folsom_slide_uniform,[set, {write_concurrency, true}, public]), 39 seed = os:timestamp(), 40 server 41 }). 42 43-record(uniform, { 44 size = ?DEFAULT_SIZE, 45 n = 1, 46 reservoir = folsom_metrics_histogram_ets:new(folsom_uniform,[set, {write_concurrency, true}, public]), 47 seed = os:timestamp() 48 }). 49 50-record(exdec, { 51 start = 0, 52 next = 0, 53 alpha = ?DEFAULT_ALPHA, 54 size = ?DEFAULT_SIZE, 55 seed = os:timestamp(), 56 n = 1, 57 reservoir = folsom_metrics_histogram_ets:new(folsom_exdec,[ordered_set, {write_concurrency, true}, public]) 58 }). 59 60-record(none, { 61 size = ?DEFAULT_SIZE, 62 n = 1, 63 reservoir = folsom_metrics_histogram_ets:new(folsom_none,[ordered_set, {write_concurrency, true}, public]) 64 }). 65 66-record(slide_sorted, { 67 size = ?DEFAULT_SIZE, 68 n = 0, 69 reservoir = folsom_metrics_histogram_ets:new(folsom_slide_sorted,[ordered_set, {write_concurrency, true}, public]) 70 }). 71 72-record(histogram, { 73 type = uniform, 74 sample = #uniform{} 75 }). 76 77-record(history, { 78 tid 79 }). 80 81-define(SYSTEM_INFO, [ 82 allocated_areas, 83 allocator, 84 alloc_util_allocators, 85 build_type, 86 c_compiler_used, 87 check_io, 88 compat_rel, 89 cpu_topology, 90 creation, 91 debug_compiled, 92 dist, 93 dist_ctrl, 94 driver_version, 95 elib_malloc, 96 dist_buf_busy_limit, 97 %fullsweep_after, % included in garbage_collection 98 garbage_collection, 99 %global_heaps_size, % deprecated 100 heap_sizes, 101 heap_type, 102 info, 103 kernel_poll, 104 loaded, 105 logical_processors, 106 logical_processors_available, 107 logical_processors_online, 108 machine, 109 %min_heap_size, % included in garbage_collection 110 %min_bin_vheap_size, % included in garbage_collection 111 modified_timing_level, 112 multi_scheduling, 113 multi_scheduling_blockers, 114 otp_release, 115 port_count, 116 process_count, 117 process_limit, 118 scheduler_bind_type, 119 scheduler_bindings, 120 scheduler_id, 121 schedulers, 122 schedulers_online, 123 smp_support, 124 system_version, 125 system_architecture, 126 threads, 127 thread_pool_size, 128 trace_control_word, 129 update_cpu_info, 130 version, 131 wordsize 132 ]). 133 134-define(STATISTICS, [ 135 context_switches, 136 %exact_reductions, % use reductions instead 137 garbage_collection, 138 io, 139 reductions, 140 run_queue, 141 runtime, 142 wall_clock 143 ]). 144 145-define(PROCESS_INFO, [ 146 backtrace, 147 binary, 148 catchlevel, 149 current_function, 150 %dictionary, 151 error_handler, 152 garbage_collection, 153 group_leader, 154 heap_size, 155 initial_call, 156 links, 157 last_calls, 158 memory, 159 %message_binary, 160 message_queue_len, 161 messages, 162 min_heap_size, 163 min_bin_vheap_size, 164 monitored_by, 165 monitors, 166 priority, 167 reductions, 168 registered_name, 169 sequential_trace_token, 170 stack_size, 171 status, 172 suspending, 173 total_heap_size, 174 trace, 175 trap_exit 176 ]). 177 178-define(SOCKET_OPTS, [ 179 active, 180 broadcast, 181 delay_send, 182 dontroute, 183 exit_on_close, 184 header, 185 keepalive, 186 nodelay, 187 packet, 188 packet_size, 189 read_packets, 190 recbuf, 191 reuseaddr, 192 send_timeout, 193 send_timeout_close, 194 sndbuf, 195 priority, 196 tos 197 ]). 198 199-define(DEFAULT_METRICS, [ 200 arithmetic_mean, 201 geometric_mean, 202 harmonic_mean, 203 histogram, 204 kurtosis, 205 n, 206 max, 207 median, 208 min, 209 {percentile, [50, 75, 95, 99, 999]}, 210 skewness, 211 standard_deviation, 212 variance 213 ]). 214