Motr  M0
histogram.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2016-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_ADDB2_HISTOGRAM_H__
26 #define __MOTR_ADDB2_HISTOGRAM_H__
27 
87 #include "addb2/counter.h"
88 #include "addb2/internal.h" /* VALUE_MAX_NR */
89 #include "lib/types.h" /* uint64_t */
90 
91 enum {
100 };
101 
103 
115  int64_t hd_min;
119  int64_t hd_max;
122 };
123 
133  int hi_skip;
135 };
136 
137 void m0_addb2_hist_add(struct m0_addb2_hist *hist, int64_t min, int64_t max,
138  uint64_t label, int idx);
140  uint64_t label, int idx);
141 void m0_addb2_hist_del(struct m0_addb2_hist *hist);
142 void m0_addb2_hist_mod(struct m0_addb2_hist *hist, int64_t val);
144  int64_t val, uint64_t datum);
145 int m0_addb2_hist_bucket(const struct m0_addb2_hist *hist, int64_t val);
146 
147 #define M0_ADDB2_HIST(id, hist, datum, ...) \
148 do { \
149  struct m0_addb2_hist *__hist = (hist); \
150  M0_ADDB2_TIMED_0((id), (datum), __VA_ARGS__); \
151  if (__hist != NULL) \
152  m0_addb2_hist_mod_with(__hist, __duration, __datum); \
153 } while (0)
154 
156 #endif /* __MOTR_ADDB2_HISTOGRAM_H__ */
157 
158 /*
159  * Local variables:
160  * c-indentation-style: "K&R"
161  * c-basic-offset: 8
162  * tab-width: 8
163  * fill-column: 80
164  * scroll-step: 1
165  * End:
166  */
167 /*
168  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
169  */
Definition: idx_mock.c:52
int m0_addb2_hist_bucket(const struct m0_addb2_hist *hist, int64_t val)
Definition: histogram.c:87
void m0_addb2_hist_mod(struct m0_addb2_hist *hist, int64_t val)
Definition: histogram.c:68
void m0_addb2_hist_del(struct m0_addb2_hist *hist)
Definition: histogram.c:63
M0_BASSERT(M0_ADDB2_HIST_BUCKETS >=2)
struct m0_addb2_hist_data hi_data
Definition: histogram.h:134
uint32_t hd_bucket[M0_ADDB2_HIST_BUCKETS]
Definition: histogram.h:121
static long long max(long long a, long long b)
Definition: crate.c:196
void m0_addb2_hist_mod_with(struct m0_addb2_hist *hist, int64_t val, uint64_t datum)
Definition: histogram.c:73
void m0_addb2_hist_add_auto(struct m0_addb2_hist *hist, int skip, uint64_t label, int idx)
Definition: histogram.c:50
struct m0_addb2_counter hi_counter
Definition: histogram.h:131
static long long min(long long a, long long b)
Definition: crate.c:191
static void skip(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
Definition: dump.c:465
void m0_addb2_hist_add(struct m0_addb2_hist *hist, int64_t min, int64_t max, uint64_t label, int idx)
Definition: histogram.c:36
Definition: hist.py:1