Emit events in better batch sizes
This commit is contained in:
30
netpod/src/histo.rs
Normal file
30
netpod/src/histo.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
#[derive(Debug)]
|
||||
pub struct HistoLog2 {
|
||||
histo: [u64; 16],
|
||||
sub: usize,
|
||||
}
|
||||
|
||||
impl HistoLog2 {
|
||||
pub fn new(sub: usize) -> Self {
|
||||
Self { histo: [0; 16], sub }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ingest(&mut self, mut v: u32) {
|
||||
let mut po = 0;
|
||||
while v != 0 && po < 15 {
|
||||
v = v >> 1;
|
||||
po += 1;
|
||||
}
|
||||
let po = if po >= self.histo.len() + self.sub {
|
||||
self.histo.len() - 1
|
||||
} else {
|
||||
if po > self.sub {
|
||||
po - self.sub
|
||||
} else {
|
||||
0
|
||||
}
|
||||
};
|
||||
self.histo[po] += 1;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod api1;
|
||||
pub mod histo;
|
||||
pub mod query;
|
||||
pub mod status;
|
||||
pub mod streamext;
|
||||
@@ -161,18 +162,16 @@ pub struct Database {
|
||||
pub pass: String,
|
||||
}
|
||||
|
||||
fn bool_false() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Cluster {
|
||||
pub nodes: Vec<Node>,
|
||||
pub database: Database,
|
||||
#[serde(default = "bool_false")]
|
||||
#[serde(rename = "runMapPulse", default)]
|
||||
pub run_map_pulse_task: bool,
|
||||
#[serde(default = "bool_false")]
|
||||
#[serde(rename = "isCentralStorage", default)]
|
||||
pub is_central_storage: bool,
|
||||
#[serde(rename = "fileIoBufferSize", default)]
|
||||
pub file_io_buffer_size: FileIoBufferSize,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
|
||||
@@ -10,4 +10,5 @@ pub struct RawEventsQuery {
|
||||
pub range: NanoRange,
|
||||
pub agg_kind: AggKind,
|
||||
pub disk_io_buffer_size: usize,
|
||||
pub do_decompress: bool,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user