commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
05b5676a746281193672bdaf6e009698ea74a2b6 | Marshall Pierce | 2017-03-13T01:15:04 | Optimize varint deserialization.
Only applicable in cases where there are still at least 9 bytes to
deserialize, but it's 5x faster. This nets 10% deser improvement for
huge histograms scaling to 40% for tiny histograms. This may be
because the tiny ones fit entirely in cache so processing improvements
are more notice... | diff --git a/src/serialization/benchmarks.rs b/src/serialization/benchmarks.rs
index ae28cf1..972fbd7 100644
--- a/src/serialization/benchmarks.rs
+++ b/src/serialization/benchmarks.rs
@@ -2,7 +2,7 @@ extern crate rand;
extern crate test;
use super::v2_serializer::varint_write;
-use super::deserializer::varint_read... | 4 | 365 | 42 |
c97a196bb2920f4bcb8f9db0310338e1672d9252 | Marshall Pierce | 2017-03-13T01:03:27 | Reformat varint_write to not be so nest-y | diff --git a/src/serialization/v2_serializer.rs b/src/serialization/v2_serializer.rs
index f7d0d4c..a8f3573 100644
--- a/src/serialization/v2_serializer.rs
+++ b/src/serialization/v2_serializer.rs
@@ -151,56 +151,49 @@ pub fn varint_write(input: u64, buf: &mut [u8]) -> usize {
if (input >> 7) == 0 {
buf[0... | 1 | 42 | 49 |
d0421459c81eadefa54e05b1ed81cb24013d5c23 | Marshall Pierce | 2017-03-12T23:36:06 | Better varint benchmarks to explore difference across byte length range | diff --git a/src/serialization/benchmarks.rs b/src/serialization/benchmarks.rs
index 6f01890..ae28cf1 100644
--- a/src/serialization/benchmarks.rs
+++ b/src/serialization/benchmarks.rs
@@ -4,36 +4,47 @@ extern crate test;
use super::v2_serializer::varint_write;
use super::deserializer::varint_read;
use std::io::Curs... | 1 | 24 | 13 |
b23321a16e2514b8c6407ec042d4cbba8a563ae4 | Marshall Pierce | 2017-03-15T17:21:22 | Simplify overflowing_add in median_equivalent: it looks like in fact that logic can (should) never overflow, so use checked_add instead. | diff --git a/src/lib.rs b/src/lib.rs
index b6dc0d4..0bb8e9c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1252,11 +1252,9 @@ impl<T: Counter> Histogram<T> {
///
/// Note that the return value is capped at `u64::max_value()`.
pub fn median_equivalent(&self, value: u64) -> u64 {
- // TODO isn't this ... | 2 | 12 | 5 |
566e2e06cd19de0315613acad136ebe8d24a6a87 | Marshall Pierce | 2017-03-15T03:50:59 | Saturate counts when recording, adding, subtracting | diff --git a/src/iterators/mod.rs b/src/iterators/mod.rs
index d3f48cd..d5fa979 100644
--- a/src/iterators/mod.rs
+++ b/src/iterators/mod.rs
@@ -159,6 +159,7 @@ impl<'a, T: 'a, P> Iterator for HistogramIterator<'a, T, P>
}
// maintain total count so we can yield percentiles
+... | 4 | 232 | 27 |
ee809e5ac62c740cc3b6d8c46ead2a37eb9b86f5 | Marshall Pierce | 2017-03-13T15:25:33 | Add record, add, and subtract benchmarks | diff --git a/benches/record.rs b/benches/record.rs
new file mode 100644
index 0000000..8c35793
--- /dev/null
+++ b/benches/record.rs
@@ -0,0 +1,145 @@
+#![feature(test)]
+
+extern crate hdrsample;
+extern crate rand;
+extern crate test;
+
+use hdrsample::*;
+use self::rand::Rng;
+use self::test::Bencher;
+
+#[bench]
+f... | 1 | 145 | 0 |
34877df3c9d27530ff012a524a97e782029c8702 | Marshall Pierce | 2017-03-12T23:21:59 | Address PR feedback: use new consts in a few more places, consume RestatState on final method call | diff --git a/src/lib.rs b/src/lib.rs
index a03a1ba..2d69691 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -160,6 +160,7 @@ use iterators::HistogramIterator;
/// Min value of a new histogram.
/// Equivalent to u64::max_value(), but const functions aren't allowed (yet).
+/// See https://github.com/rust-lang/rust/issues... | 1 | 5 | 3 |
32e4b114346f4961d33fd6adfb4849bf72668d1e | Marshall Pierce | 2017-03-12T17:31:09 | Do restat calculations during deserialization so another pass over the counts is not required | diff --git a/src/lib.rs b/src/lib.rs
index f67d943..a03a1ba 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -158,6 +158,12 @@ use std::ops::{Index, IndexMut, AddAssign, SubAssign};
use iterators::HistogramIterator;
+/// Min value of a new histogram.
+/// Equivalent to u64::max_value(), but const functions aren't allow... | 3 | 75 | 29 |
de6944294064647662d1784183d01c33eaf300ac | Marshall Pierce | 2017-03-11T05:48:39 | Fix typo | diff --git a/src/serialization/serialization.rs b/src/serialization/serialization.rs
index 51ea008..0aa623b 100644
--- a/src/serialization/serialization.rs
+++ b/src/serialization/serialization.rs
@@ -31,7 +31,7 @@
//! # API
//!
//! Each serialization format has its own serializer struct, but since each format is re... | 1 | 1 | 1 |
e7907c6973d242a33d2c3136e3f9778058154e13 | Marshall Pierce | 2017-03-11T01:56:49 | Comment fix | diff --git a/src/serialization/v2_serializer.rs b/src/serialization/v2_serializer.rs
index 14c7bf1..f7d0d4c 100644
--- a/src/serialization/v2_serializer.rs
+++ b/src/serialization/v2_serializer.rs
@@ -37,7 +37,7 @@ impl V2Serializer {
}
/// Serialize the histogram into the provided writer.
- /// Returns ... | 1 | 1 | 1 |
504977715168704b0f8ebe0962836f48740a2c38 | Marshall Pierce | 2017-03-11T01:02:05 | Further tweaks to documentation | diff --git a/src/serialization/deserializer.rs b/src/serialization/deserializer.rs
index c84be2d..787b7b0 100644
--- a/src/serialization/deserializer.rs
+++ b/src/serialization/deserializer.rs
@@ -48,7 +48,10 @@ impl Deserializer {
}
}
- /// Deserialize an encoded histogram.
+ /// Deserialize an e... | 3 | 35 | 5 |
781ba8be9d8dfa8ad078b6979855c728d7610c13 | Marshall Pierce | 2017-03-10T20:51:38 | Make serialization benchmark sparseness easier to understand | diff --git a/benches/serialization.rs b/benches/serialization.rs
index 8953c5e..32c8945 100644
--- a/benches/serialization.rs
+++ b/benches/serialization.rs
@@ -14,108 +14,108 @@ use std::io::Cursor;
#[bench]
fn serialize_tiny_dense(b: &mut Bencher) {
// 256 + 3 * 128 = 640 counts
- do_serialize_bench(b, 1, 2... | 1 | 22 | 22 |
d2f8c452f6ad195d0819b165031cfc7c1118bcb8 | Marshall Pierce | 2017-03-10T20:26:11 | Fortunately, serialization + deserialization has no measurable performance loss for including ErrorKind in IoError, so now it's included. | diff --git a/src/serialization/deserializer.rs b/src/serialization/deserializer.rs
index 19ea800..156e8b1 100644
--- a/src/serialization/deserializer.rs
+++ b/src/serialization/deserializer.rs
@@ -1,7 +1,7 @@
use super::V2_COOKIE;
use super::super::{Counter, Histogram};
use super::super::num::ToPrimitive;
-use std::... | 4 | 18 | 18 |
e7f742fa8f6dff0fcd4a3b7bda51174cfb5329a5 | Marshall Pierce | 2017-03-10T20:14:53 | Use helpers more consistently in varint_write | diff --git a/src/serialization/v2_serializer.rs b/src/serialization/v2_serializer.rs
index 8a0f246..be1fa08 100644
--- a/src/serialization/v2_serializer.rs
+++ b/src/serialization/v2_serializer.rs
@@ -144,46 +144,45 @@ pub fn varint_write(input: u64, buf: &mut [u8]) -> usize {
// This way about twice as fast as th... | 1 | 19 | 21 |
e8b2f33a4bdb8ffb2f5141a9f975af46d8504625 | Marshall Pierce | 2017-03-09T17:37:52 | Split v2 serializer and deserializer into their own files | diff --git a/src/serialization/benchmarks.rs b/src/serialization/benchmarks.rs
index e63fc90..6f01890 100644
--- a/src/serialization/benchmarks.rs
+++ b/src/serialization/benchmarks.rs
@@ -1,7 +1,9 @@
extern crate rand;
extern crate test;
-use super::*;
+use super::v2_serializer::varint_write;
+use super::deseriali... | 5 | 423 | 404 |
e93c0c33f68029f8c3ef4d6c5aec35352441679a | Marshall Pierce | 2017-03-09T16:46:37 | Remove Bounded requirement that's no longer needed, and add a comment | diff --git a/src/lib.rs b/src/lib.rs
index 6088ca3..fd52180 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -165,12 +165,12 @@ use iterators::HistogramIterator;
/// into an integer count. Partial ordering is used for threshholding, also usually in the context
/// of percentiles.
pub trait Counter
- : num::Num + num::... | 2 | 4 | 3 |
db4682f06f904244475307c4c360e52546c37a43 | Marshall Pierce | 2017-03-09T16:18:41 | Add a few comments | diff --git a/src/serialization/serialization.rs b/src/serialization/serialization.rs
index a388c5c..5ccb659 100644
--- a/src/serialization/serialization.rs
+++ b/src/serialization/serialization.rs
@@ -207,6 +207,7 @@ impl Deserializer {
}
}
+ // TODO destat is expensive; should accumulate... | 1 | 3 | 0 |
faabadd52786a9f6b6cc39ced3be8181f5097877 | Marshall Pierce | 2017-03-09T15:42:57 | varint_read benchmarks | diff --git a/src/serialization/benchmarks.rs b/src/serialization/benchmarks.rs
index 47089b6..e63fc90 100644
--- a/src/serialization/benchmarks.rs
+++ b/src/serialization/benchmarks.rs
@@ -6,15 +6,25 @@ use self::rand::Rng;
use self::test::Bencher;
#[bench]
-fn varint_write_rand_1000(b: &mut Bencher) {
+fn varint_w... | 1 | 31 | 2 |
248cf634fd65be77bba004dab998cf5a68300897 | Marshall Pierce | 2017-03-08T20:47:05 | 20-30% deserialization speedup from adding #[inline] to helper calls | diff --git a/src/serialization/serialization.rs b/src/serialization/serialization.rs
index c2dbe05..a388c5c 100644
--- a/src/serialization/serialization.rs
+++ b/src/serialization/serialization.rs
@@ -385,10 +385,12 @@ fn nth_7b_chunk_with_high_bit(input: u64, n: u8) -> u8 {
}
/// truncate byte to low 7 bits, cast ... | 1 | 3 | 0 |
53434a2ece81b278b89a234483b5edec6ed57408 | Marshall Pierce | 2017-03-08T20:41:30 | Add deserialization benchmarks | diff --git a/benches/serialization.rs b/benches/serialization.rs
index 79a4a83..8953c5e 100644
--- a/benches/serialization.rs
+++ b/benches/serialization.rs
@@ -9,6 +9,7 @@ use hdrsample::serialization::*;
use self::rand::distributions::range::Range;
use self::rand::distributions::IndependentSample;
use self::test::... | 1 | 72 | 0 |
d43db6c8ced44cb9b13c2cef06f4698c72663b11 | Marshall Pierce | 2017-03-08T17:50:27 | Better serialization benchmarks at different non-zero count densities | diff --git a/benches/serialization.rs b/benches/serialization.rs
index 54395a6..79a4a83 100644
--- a/benches/serialization.rs
+++ b/benches/serialization.rs
@@ -11,33 +11,63 @@ use self::rand::distributions::IndependentSample;
use self::test::Bencher;
#[bench]
-fn serialize_small(b: &mut Bencher) {
+fn serialize_ti... | 1 | 40 | 12 |
cf48ce5bac63aca4f8dfd298d0551952ca00e522 | Marshall Pierce | 2017-03-08T17:32:21 | Another 20% speedup from inlining some helper calls | diff --git a/src/serialization/serialization.rs b/src/serialization/serialization.rs
index 41972e2..c2dbe05 100644
--- a/src/serialization/serialization.rs
+++ b/src/serialization/serialization.rs
@@ -259,6 +259,7 @@ fn encode_counts<T: Counter>(h: &Histogram<T>, buf: &mut [u8]) -> Result<usize,
/// quite the same as ... | 1 | 4 | 0 |
59aa4221490eca197ed463f4a37045a7550360c3 | Marshall Pierce | 2017-03-08T17:02:49 | With tasteful application of unsafe, serialization speeds up about 25% for small and medium sized histograms | diff --git a/src/lib.rs b/src/lib.rs
index 92ba734..6088ca3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1249,10 +1249,6 @@ impl<T: Counter> Histogram<T> {
// Internal helpers
// ********************************************************************************************
- fn count_at_index(&self, index:... | 2 | 6 | 7 |
497a2df15cd3b624b52254351848497b7b0f5793 | Marshall Pierce | 2017-03-08T04:38:36 | Add basic deserialization support | diff --git a/src/lib.rs b/src/lib.rs
index 6f3e834..b256ace 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -162,12 +162,12 @@ use iterators::HistogramIterator;
/// into an integer count. Partial ordering is used for threshholding, also usually in the context
/// of percentiles.
pub trait Counter
- : num::Num + num::... | 3 | 333 | 41 |
3a8e5a0cadeb62c9d626efcb2fd336ab4b924c5f | Marshall Pierce | 2017-03-06T04:50:18 | Add tests for encode_counts | diff --git a/src/serialization/serialization.rs b/src/serialization/serialization.rs
index 3d2730a..b04d37b 100644
--- a/src/serialization/serialization.rs
+++ b/src/serialization/serialization.rs
@@ -2,6 +2,7 @@ extern crate byteorder;
use super::{Counter, Histogram};
use std::io::{self, Read, Write};
+use std;
u... | 3 | 147 | 11 |
b7c9b136f9507ce7959ba492b98a38ae0a86ee5a | Marshall Pierce | 2017-03-06T01:18:29 | Better varint tests, plus WIP on serialization | diff --git a/Cargo.toml b/Cargo.toml
index f4473e9..27958a6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,6 +25,7 @@ benchmark = [] # for crates.io publication
[dependencies]
num = "0.1"
+byteorder = "1.0.0"
#criterion = { git = "https://github.com/japaric/criterion.rs.git", optional = true }
[dev-dependencie... | 4 | 214 | 76 |
e26e30b538c3f88a7996e4ddf94ffffee7eb00de | Marshall Pierce | 2017-03-05T14:58:37 | LEB128-64b9B varint encoding | diff --git a/src/serialization/serialization.rs b/src/serialization/serialization.rs
index 3a0f763..600a8e9 100644
--- a/src/serialization/serialization.rs
+++ b/src/serialization/serialization.rs
@@ -1,7 +1,163 @@
+use std::io::{self, Read, Write};
+
#[path = "tests.rs"]
#[cfg(test)]
mod tests;
+/// Write a numbe... | 2 | 222 | 2 |
9a8dabcc2d0ac1c72b7e1a4ddf7c4b7b8603d3da | Marshall Pierce | 2017-03-04T23:53:04 | Zig zag encoding | diff --git a/src/lib.rs b/src/lib.rs
index 156e0a8..b6f74f4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1503,3 +1503,6 @@ impl<T: Counter, F: Counter> PartialEq<Histogram<F>> for Histogram<T>
#[path = "tests/tests.rs"]
#[cfg(test)]
mod tests;
+
+#[path = "serialization/serialization.rs"]
+mod serialization;
diff --... | 3 | 71 | 0 |
9d81ce4aa7cfe5efe788ddd2305f310d24f61339 | Marshall Pierce | 2017-02-27T17:10:52 | Simplify equivalent range calculation | diff --git a/src/lib.rs b/src/lib.rs
index da5abc5..156e0a8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1239,16 +1239,7 @@ impl<T: Counter> Histogram<T> {
/// any two equivalent values are counted in a common total count.
pub fn equivalent_range(&self, value: u64) -> u64 {
let bucket_index = self.bu... | 2 | 2 | 10 |
9779fbfa97e1ec95fa821d76b4af9fe68766a1ec | Marshall Pierce | 2017-02-24T18:35:35 | Tests for value_from_loc, value_for, lowest_equivalent, highest_equivalent, and equivalent_range. | diff --git a/src/lib.rs b/src/lib.rs
index 0f9b0fe..da5abc5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1173,10 +1173,11 @@ impl<T: Counter> Histogram<T> {
// Dividing by sub bucket half count will yield 1 in top half of first bucket, 2 in
// in the top half (i.e., the only half that's used) of the... | 3 | 361 | 7 |
cbc624bf7a0ff7de4025c2fd0abf2626cee47c8b | Marshall Pierce | 2017-02-21T19:15:59 | Add tests for bucket and sub bucket indexing | diff --git a/src/tests/index_calculation.rs b/src/tests/index_calculation.rs
index 48165ba..90071c7 100644
--- a/src/tests/index_calculation.rs
+++ b/src/tests/index_calculation.rs
@@ -151,3 +151,231 @@ fn unit_magnitude_62_sub_bucket_magnitude_1_ok() {
assert_eq!(1, h.bucket_for(u64::max_value()));
assert_eq... | 1 | 228 | 0 |
d9688d73bd1ca22629e37de6d675d3adbfa70f75 | Marshall Pierce | 2017-02-20T21:00:31 | Better enum names and docs | diff --git a/src/lib.rs b/src/lib.rs
index 3379160..0f9b0fe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -243,15 +243,25 @@ pub struct Histogram<T: Counter> {
/// Errors that can occur when creating a histogram.
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
pub enum CreationError {
- /// Lowest discernible value mu... | 1 | 41 | 27 |
942f4f4f0dbdac1b299d7a695a0078aab50942f7 | Marshall Pierce | 2017-02-19T13:21:24 | Use enums for errors. | diff --git a/src/lib.rs b/src/lib.rs
index d25a412..3379160 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -240,6 +240,42 @@ pub struct Histogram<T: Counter> {
counts: Vec<T>,
}
+/// Errors that can occur when creating a histogram.
+#[derive(Debug, Eq, PartialEq, Clone, Copy)]
+pub enum CreationError {
+ /// Lo... | 3 | 54 | 21 |
382a55b259f102399e4775c3d09e149e4853c1b9 | Marshall Pierce | 2017-02-20T18:13:39 | Three std::cmp's is probably enough. Other cleanup. | diff --git a/src/lib.rs b/src/lib.rs
index 9f49a40..326f36e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -150,11 +150,9 @@
extern crate num;
-use std::ops::Index;
-use std::ops::IndexMut;
-use std::ops::AddAssign;
-use std::ops::SubAssign;
use std::borrow::Borrow;
+use std::cmp;
+use std::ops::{Index, IndexMut, Ad... | 1 | 3 | 10 |
2285c387dd66309b5ce650a179fe3376ec134d6c | Marshall Pierce | 2017-02-20T18:08:39 | Remove a now-obsolete panic warning, and fix a typo | diff --git a/src/lib.rs b/src/lib.rs
index 9f49a40..5c0b2ba 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -295,8 +295,6 @@ impl<T: Counter> Histogram<T> {
// ********************************************************************************************
/// Find the bucket the given value should be placed in.
- ... | 1 | 1 | 3 |
e2891c7cc7ef70ef2a203700c501814dee225b9f | Marshall Pierce | 2017-02-19T01:21:31 | Limit unit magnitude + precision to fit into 63 bits. Approach and tests ported from equivalent PR to Java impl. | diff --git a/src/lib.rs b/src/lib.rs
index 9f49a40..fdcba5a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -632,9 +632,13 @@ impl<T: Counter> Histogram<T> {
let sub_bucket_count = 1_u32 << (sub_bucket_count_magnitude as u32);
if unit_magnitude + sub_bucket_count_magnitude > 63 {
- // Cannot ... | 3 | 163 | 3 |
865a2e8db1431c75a4178b61c3e277636a958fbb | Marshall Pierce | 2017-02-20T04:17:32 | Split the unit tests into several files. | diff --git a/src/lib.rs b/src/lib.rs
index ffea191..d6e4e44 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1468,5 +1468,6 @@ impl<T: Counter, F: Counter> PartialEq<Histogram<F>> for Histogram<T>
// TODO: timestamps and tags
// TODO: textual output
+#[path = "tests/tests.rs"]
#[cfg(test)]
mod tests;
diff --git a/src... | 4 | 22 | 21 |
4b6d1e56c7c2feaf8bae309a8aa2b4a6742a4557 | Marshall Pierce | 2017-02-18T17:20:54 | Use sub_bucket_half_count instead of dividing sub_bucket_count | diff --git a/src/lib.rs b/src/lib.rs
index ffea191..5c4b068 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1276,8 +1276,7 @@ impl<T: Counter> Histogram<T> {
/// Or, equivalently, we need 1 more bucket to capture the max value if we consider the
/// sub-bucket length to be halved.
fn num_bins(&self, number_... | 1 | 1 | 2 |
d5f85e7ab52c35be0dc7ebad0faa728e121548d0 | Marshall Pierce | 2017-02-18T16:39:55 | Better value_from_loc comment | diff --git a/src/lib.rs b/src/lib.rs
index 6031109..ffea191 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1241,8 +1241,10 @@ impl<T: Counter> Histogram<T> {
#[inline]
fn value_from_loc(&self, bucket_index: u8, sub_bucket_index: u32) -> u64 {
- // sum won't overflow; bucket_index and unit_magnitude are... | 1 | 4 | 2 |
efd9ca7b4bb9bf844e591553f5e99ca3f0a344c0 | Marshall Pierce | 2017-02-18T16:37:21 | Add further detail about accuracy of value_from_loc bit manipulations | diff --git a/src/lib.rs b/src/lib.rs
index 2f6c81d..6031109 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1241,7 +1241,8 @@ impl<T: Counter> Histogram<T> {
#[inline]
fn value_from_loc(&self, bucket_index: u8, sub_bucket_index: u32) -> u64 {
- // sum won't overflow; bucket_index and unit_magnitude are ... | 1 | 2 | 1 |
64fb32691c39042c21b4fbf1f221673e0e20f534 | Marshall Pierce | 2017-02-18T05:11:30 | Make index_for use usize, simplify initialization logic, add comments | diff --git a/src/lib.rs b/src/lib.rs
index be1a30f..2f6c81d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -297,7 +297,7 @@ impl<T: Counter> Histogram<T> {
/// Find the bucket the given value should be placed in.
///
/// May panic if the given value falls outside the current range of the histogram.
- fn ... | 1 | 34 | 37 |
b9dc4e7e32d2b134fc396f538fad49571b94df6a | Marshall Pierce | 2017-02-15T18:28:31 | Add explanation to SIGFIG consts. | diff --git a/tests/data_access.rs b/tests/data_access.rs
index fa1716b..55bece6 100644
--- a/tests/data_access.rs
+++ b/tests/data_access.rs
@@ -28,6 +28,7 @@ struct Loaded {
}
const TRACKABLE_MAX: u64 = 3600 * 1000 * 1000;
+// Store up to 2 * 10^3 in single-unit precision. Can be 5 at most.
const SIGFIG: u8 = 3;
... | 2 | 2 | 0 |
2c155423e033ca7fb87d69958b7f5da08f523272 | Marshall Pierce | 2017-02-14T19:04:39 | Reduce memory footprint per histogram.
Size shrinks from 144 bytes (according to std::mem::size_of) to 112
on a 64-bit system. | diff --git a/Cargo.toml b/Cargo.toml
index e16fa3d..f4473e9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,6 +27,9 @@ benchmark = [] # for crates.io publication
num = "0.1"
#criterion = { git = "https://github.com/japaric/criterion.rs.git", optional = true }
+[dev-dependencies]
+rand = "0.3.15"
+
[lib]
path = "s... | 6 | 141 | 60 |
390df15aa94a1c93069a1e889a4ee5a84f84417c | Marshall Pierce | 2017-02-14T18:27:08 | Tests for initialization logic | diff --git a/src/lib.rs b/src/lib.rs
index 52a836a..751f7ee 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -206,6 +206,7 @@ impl<T> Counter for T
/// = 2048 * 2^(k-1)`, which is the k-1'th bucket's end. So, we would use the previous bucket
/// for those lower values as it has better precision.
///
+#[derive(Debug)]
pu... | 2 | 283 | 0 |
1a7fb63cf03e1f326b568a9e8979983d12607623 | Marshall Pierce | 2017-02-14T21:44:56 | Remove unused #[allow] | diff --git a/tests/auto_resize.rs b/tests/auto_resize.rs
index eeb95d9..0afe42d 100644
--- a/tests/auto_resize.rs
+++ b/tests/auto_resize.rs
@@ -1,7 +1,5 @@
//! Tests from HistogramAutosizingTest.java
-#![allow(non_snake_case)]
-
extern crate hdrsample;
use hdrsample::Histogram;
diff --git a/tests/data_access.rs... | 3 | 0 | 6 |
bc53916e3b150e1580109e3a736cd8c6b3631770 | Marshall Pierce | 2017-02-13T19:51:56 | Use literal field name in comments rather than human-oriented equivalent since it's non-public API. | diff --git a/src/lib.rs b/src/lib.rs
index 45a8bf1..52a836a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1275,7 +1275,7 @@ impl<T: Counter> Histogram<T> {
self.counts.resize(len, T::zero());
}
- /// Set internally tracked max value to new value if new value is greater than current one.
+ /// Set i... | 1 | 2 | 2 |
016bba4772be76725e954670f2fb456d7f8f9c00 | Marshall Pierce | 2017-02-13T19:48:49 | Fix a few strays in the comments | diff --git a/src/iterators/linear.rs b/src/iterators/linear.rs
index f8cdb5a..248f184 100644
--- a/src/iterators/linear.rs
+++ b/src/iterators/linear.rs
@@ -22,7 +22,7 @@ impl<'a, T: 'a + Counter> Iter<'a, T> {
Iter {
hist: hist,
... | 5 | 37 | 37 |
a5bcaf5d3e35d672794e19dd227dad26cca60047 | Jon Gjengset | 2017-01-30T17:40:07 | Comment out criterion for crates.io publication | diff --git a/Cargo.toml b/Cargo.toml
index 118d2f5..e16fa3d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,12 +20,12 @@ license = "MIT/Apache-2.0"
travis-ci = { repository = "jonhoo/hdrsample" }
[features]
-benchmark = ["criterion"]
-#benchmark = [] # for crates.io publication
+#benchmark = ["criterion"]
+benchmar... | 1 | 3 | 3 |
d0ff1b730cfd40a926a44ec552eef8cf814758f4 | Marshall Pierce | 2017-01-07T19:59:19 | Re-applying the `use` for HistogramIterator | diff --git a/src/lib.rs b/src/lib.rs
index 69535dd..4bf2238 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -148,6 +148,8 @@ use std::ops::AddAssign;
use std::ops::SubAssign;
use std::borrow::Borrow;
+use iterators::HistogramIterator;
+
/// This auto-implemented marker trait represents the operations a histogram must ... | 1 | 7 | 5 |
7f4c6ebc0e7ecd2da76bcbafe1b1407b9d764acc | Marshall Pierce | 2017-01-07T19:55:45 | Switch to private members and public functions of IterationValue | diff --git a/src/iterators/mod.rs b/src/iterators/mod.rs
index a788914..b610279 100644
--- a/src/iterators/mod.rs
+++ b/src/iterators/mod.rs
@@ -50,14 +50,43 @@ pub struct HistogramIterator<'a, T: 'a + Counter, P: PickyIterator<T>> {
/// The value emitted at each step when iterating over a `Histogram`.
#[derive(Debug... | 4 | 104 | 109 |
d955ffb4540851854e0ba5abb606c01bf3ff19f8 | Marshall Pierce | 2017-01-07T00:27:13 | Use mod prefix for HistogramIterator | diff --git a/src/lib.rs b/src/lib.rs
index aead169..83cef9f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -148,8 +148,6 @@ use std::ops::AddAssign;
use std::ops::SubAssign;
use std::borrow::Borrow;
-use iterators::HistogramIterator;
-
/// This auto-implemented marker trait represents the operations a histogram must ... | 1 | 5 | 7 |
d281b8ba2283a97827152d14477ffd492d1b267d | Marshall Pierce | 2017-01-06T18:17:22 | Use a struct instead of a tuple for iteration | diff --git a/src/iterators/mod.rs b/src/iterators/mod.rs
index 010230f..a788914 100644
--- a/src/iterators/mod.rs
+++ b/src/iterators/mod.rs
@@ -47,6 +47,19 @@ pub struct HistogramIterator<'a, T: 'a + Counter, P: PickyIterator<T>> {
picker: P,
}
+/// The value emitted at each step when iterating over a `Histogr... | 4 | 165 | 129 |
2e11c5839c5b19c535b94719d17b262654147b81 | Marshall Pierce | 2017-01-06T17:03:53 | Use underscores in numeric literals | diff --git a/src/iterators/percentile.rs b/src/iterators/percentile.rs
index 1aa28ad..0cdc58e 100644
--- a/src/iterators/percentile.rs
+++ b/src/iterators/percentile.rs
@@ -52,8 +52,8 @@ impl<'a, T: 'a + Counter> PickyIterator<T> for Iter<'a, T> {
let percentileReportingTicks =
self.percentileTi... | 4 | 23 | 23 |
6833865ce77ec4dd413403c914476c8eeae6335e | Marshall Pierce | 2017-01-06T15:20:39 | Make cover() assert! instead of return Err since it's a programmer-error type thing that probably wouldn't be recovered from in practice | diff --git a/src/lib.rs b/src/lib.rs
index a89855e..c05f4c2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -642,7 +642,7 @@ impl<T: Counter> Histogram<T> {
};
// determine exponent range needed to support the trackable value with no overflow:
- let len = try!(h.cover(high));
+ let len = h... | 1 | 6 | 7 |
049429b4364af4522221cf7375ee7a2f14fd6631 | Marshall Pierce | 2017-01-06T05:11:18 | Provide error messages in asserts | diff --git a/src/iterators/linear.rs b/src/iterators/linear.rs
index 818940b..601af08 100644
--- a/src/iterators/linear.rs
+++ b/src/iterators/linear.rs
@@ -17,7 +17,7 @@ impl<'a, T: 'a + Counter> Iter<'a, T> {
pub fn new(hist: &'a Histogram<T>,
valueUnitsPerBucket: u64)
-> Histogra... | 2 | 3 | 3 |
36f30774e3d88bb0dc7e66aa797526a730c77b26 | Marshall Pierce | 2017-01-05T21:31:24 | Add some comments and asserts around u64-ness | diff --git a/src/iterators/linear.rs b/src/iterators/linear.rs
index bd98f3c..818940b 100644
--- a/src/iterators/linear.rs
+++ b/src/iterators/linear.rs
@@ -6,6 +6,7 @@ use iterators::{HistogramIterator, PickyIterator};
pub struct Iter<'a, T: 'a + Counter> {
hist: &'a Histogram<T>,
+ // > 0
valueUnitsPe... | 3 | 17 | 4 |
f82414e7fddc2a67d02dc1ced9fdf8633e59aa8b | Jon Gjengset | 2016-08-01T19:11:58 | Tidy up counter bounds | diff --git a/src/iterators/all.rs b/src/iterators/all.rs
index e6e7f8a..6c78c11 100644
--- a/src/iterators/all.rs
+++ b/src/iterators/all.rs
@@ -1,4 +1,4 @@
-use num;
+use Counter;
use Histogram;
use iterators::{HistogramIterator, PickyIterator};
@@ -7,14 +7,13 @@ pub struct Iter(Option<usize>);
impl Iter {
... | 9 | 109 | 92 |
e963dcf3dc49c42d69e6fc46080e32bed93363e6 | Jon Gjengset | 2016-07-28T23:17:21 | set_to and family should return Results | diff --git a/Cargo.toml b/Cargo.toml
index 4488e3f..67faceb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "hdrsample"
-version = "2.1.0"
+version = "2.1.1"
description = "A port of HdrHistogram to Rust"
readme = "README.md"
diff --git a/src/lib.rs b/src/lib.rs
index 5d514c7..e94f84c 10... | 3 | 12 | 9 |
8611ca6d470bbd18f5a0cabb9d0136a7740088f5 | Jon Gjengset | 2016-07-28T22:46:34 | Avoid multiple impl blocks with different bounds | diff --git a/Cargo.toml b/Cargo.toml
index a41765a..fef38b5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "hdrsample"
-version = "1.1.1"
+version = "2.0.0"
description = "A port of HdrHistogram to Rust"
readme = "README.md"
diff --git a/src/iterators/linear.rs b/src/iterators/linear.rs... | 7 | 51 | 48 |
86dade91cb5d54d90a6adbdae6cf984588f86552 | Jon Gjengset | 2016-07-11T16:17:56 | Comment out criterion for crates.io publication | diff --git a/Cargo.toml b/Cargo.toml
index 7fd2260..06d25ef 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,6 +17,7 @@ license = "MIT/Apache-2.0"
[features]
benchmark = ["criterion"]
+#benchmark = [] # for crates.io publication
[dependencies]
num = "0.1" | 1 | 1 | 0 |
d29d7db394c0ad6a09cc39052962726b1a539d4c | Jon Gjengset | 2016-07-11T16:13:32 | Make the critical recording path slightly faster | diff --git a/Cargo.toml b/Cargo.toml
index 53b0461..7fd2260 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "hdrsample"
-version = "1.1.0"
+version = "1.1.1"
description = "A port of HdrHistogram to Rust"
readme = "README.md"
diff --git a/src/lib.rs b/src/lib.rs
index 86dfd76..9ec258f 10... | 2 | 24 | 24 |
0d0243a55c52340d9fb06e3278b2b147626efef9 | Jon Gjengset | 2016-07-09T22:47:24 | Avoid overflows in equivalences when value is high | diff --git a/src/lib.rs b/src/lib.rs
index becde9a..fffa019 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -807,7 +807,10 @@ impl<T: num::Num> Histogram<T> {
* are counted in a common total count.
*/
pub fn median_equivalent(&self, value: i64) -> i64 {
- self.lowest_equivalent(value) + (self.equiva... | 2 | 8 | 4 |
b6e081a4e062ee7c8d09636a6935c4363534d337 | Jon Gjengset | 2016-07-09T22:40:32 | Remove test_ prefixes from test names | diff --git a/tests/auto_resize.rs b/tests/auto_resize.rs
index 54b149f..e7e8254 100644
--- a/tests/auto_resize.rs
+++ b/tests/auto_resize.rs
@@ -8,7 +8,7 @@ use hdrsample::Histogram;
#[test]
#[ignore]
-fn test_histogram_autosizing_edges() {
+fn histogram_autosizing_edges() {
let mut histogram = Histogram::<u64... | 3 | 42 | 42 |
fbb732fffc7e317596e2320d21f55e5d45e44a5a | Jon Gjengset | 2016-07-09T22:39:24 | Add ported upstream autosizing tests | diff --git a/src/lib.rs b/src/lib.rs
index 75f3370..becde9a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1032,6 +1032,10 @@ impl<T: num::Num> Histogram<T> {
(subBucketIndex as i64) << (bucketIndex + self.unitMagnitude)
}
+ pub fn bucketCount(&self) -> usize {
+ self.bucketCount
+ }
+
p... | 2 | 55 | 0 |
ed525476c63f2d6dac68339f585d2e6ad85e58fd | Jon Gjengset | 2016-07-09T22:36:56 | Simplify the logic of handleRecordException | diff --git a/src/lib.rs b/src/lib.rs
index 2251d4f..75f3370 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -613,8 +613,12 @@ impl<T: num::Num + num::ToPrimitive + Copy> Histogram<T> {
} else {
false
};
- if !success && !self.handleRecordException(count, value) {
- return Er... | 1 | 7 | 8 |
e9eee4dea7cfa77879561a5ce7cdd8496d73037f | Jon Gjengset | 2016-07-09T22:36:32 | Bring all iterators in line with HdrHistogram | diff --git a/src/iterators/all.rs b/src/iterators/all.rs
index 8f7fc70..c2dcd4a 100644
--- a/src/iterators/all.rs
+++ b/src/iterators/all.rs
@@ -2,20 +2,26 @@ use num;
use Histogram;
use iterators::{HistogramIterator, PickyIterator};
-pub struct Iter;
+pub struct Iter(Option<usize>);
impl Iter {
pub fn new<... | 6 | 117 | 68 |
a091707bcf5c1934cf0788fd85471ad327a45834 | Jon Gjengset | 2016-07-09T22:35:10 | Add more histogram tests from original test suite | diff --git a/tests/histogram.rs b/tests/histogram.rs
new file mode 100644
index 0000000..065ea8f
--- /dev/null
+++ b/tests/histogram.rs
@@ -0,0 +1,296 @@
+//! Tests from HistogramTest.java
+
+#![allow(non_snake_case)]
+
+extern crate hdrsample;
+extern crate num;
+
+use hdrsample::Histogram;
+use std::borrow::Borrow;
+... | 1 | 296 | 0 |
7bdbdd59d3bed2f21ea5a2926651a1b67946e87a | Jon Gjengset | 2016-07-09T22:34:41 | Move tests, add more of the original ones, and fix for API changes | diff --git a/tests/data_access.rs b/tests/data_access.rs
new file mode 100644
index 0000000..0c62703
--- /dev/null
+++ b/tests/data_access.rs
@@ -0,0 +1,456 @@
+//! Tests from HistogramDataAccessTest.java
+
+#![allow(non_snake_case)]
+
+extern crate hdrsample;
+
+use hdrsample::Histogram;
+
+macro_rules! assert_near {
... | 2 | 456 | 290 |
c8d873ab97dd26c01a34236ff1e83254c18c53bf | Jon Gjengset | 2016-07-09T22:33:56 | Fix up the interface a bit | diff --git a/src/iterators/linear.rs b/src/iterators/linear.rs
index 2529ee7..e565c79 100644
--- a/src/iterators/linear.rs
+++ b/src/iterators/linear.rs
@@ -27,7 +27,7 @@ impl<'a, T: 'a + num::Num + Copy> Iter<'a, T> {
impl<'a, T: 'a + num::Num + Copy> PickyIterator<T> for Iter<'a, T> {
fn pick(&mut self, index... | 4 | 30 | 18 |
78e8ac81c76511f133774a34182ae74ba8553574 | Marc-Antoine Perennou | 2025-08-13T18:35:10 | update Cargo.lock | diff --git a/Cargo.lock b/Cargo.lock
index 8ad54c8..c8480bf 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -13,15 +13,15 @@ dependencies = [
[[package]]
name = "adler2"
-version = "2.0.0"
+version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "512761e0bb2578dd7380c6baaa0f4ce03... | 1 | 167 | 81 |
593b860452e5a3822f2b2f5bef0061adade1d1e4 | Marc-Antoine Perennou | 2025-02-26T13:55:37 | fix tokio feature | diff --git a/src/tokio.rs b/src/tokio.rs
index a594640..ca4727a 100644
--- a/src/tokio.rs
+++ b/src/tokio.rs
@@ -1,5 +1,4 @@
use once_cell::sync::Lazy;
-use tokio_crate as tokio;
pub(crate) fn enter() -> tokio::runtime::EnterGuard<'static> {
RUNTIME.enter()
@@ -21,8 +20,6 @@ static RUNTIME: Lazy<tokio::runtime... | 1 | 0 | 3 |
aa23ce76f75dc87e0310ac1df2c67c4a33b74eeb | Marc-Antoine Perennou | 2025-02-26T13:55:07 | use StaticExecutor | diff --git a/Cargo.toml b/Cargo.toml
index 591eedc..887a676 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,12 +20,15 @@ tokio = ["dep:tokio"]
[dependencies]
async-channel = "^2.1.1"
-async-executor = "^1.8"
async-lock = "^3.2"
blocking = "^1.5"
futures-lite = "^2.0"
once_cell = "^1.4"
+[dependencies.async-ex... | 2 | 6 | 3 |
10e08e80f0a6c0d7f2db0e97629d5faceea8acf9 | Marc-Antoine Perennou | 2023-11-13T14:42:17 | drop support for pre 1.0 tokio | diff --git a/Cargo.toml b/Cargo.toml
index b753964..41d507f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,8 +16,6 @@ rust-version = "1.60"
[features]
default = ["async-io"]
tokio = ["tokio-crate"]
-tokio02 = ["tokio02-crate"]
-tokio03 = ["tokio03-crate"]
[dependencies]
async-channel = "^2.1.1"
@@ -38,19 +36,5 ... | 5 | 0 | 106 |
32e8ff9b53c9661e7830865b341b11f6233be1de | Pi-Cla | 2024-11-19T14:56:07 | Update clippy allows and use const in thread local
https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_thread_local | diff --git a/src/executor.rs b/src/executor.rs
index 838fbd6..44924f4 100644
--- a/src/executor.rs
+++ b/src/executor.rs
@@ -5,7 +5,7 @@ use std::future::Future;
pub(crate) static GLOBAL_EXECUTOR: Executor<'_> = Executor::new();
thread_local! {
- pub(crate) static LOCAL_EXECUTOR: LocalExecutor<'static> = LocalEx... | 2 | 4 | 4 |
37f393cc9309f1e41262df8e20be5a020f3223ae | Marc-Antoine Perennou | 2023-12-11T13:31:55 | update async deps | diff --git a/Cargo.toml b/Cargo.toml
index 31cd570..22ad447 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,15 +20,15 @@ tokio02 = ["tokio02-crate"]
tokio03 = ["tokio03-crate"]
[dependencies]
-async-channel = "^2.1"
-async-executor = "^1.7"
-async-lock = "^3.1"
+async-channel = "^2.1.1"
+async-executor = "^1.8"
+as... | 1 | 4 | 4 |
c49cd357daac2b5ad3a05f6f6045531614f80d3b | Marc-Antoine Perennou | 2023-11-13T14:45:56 | update async deps | diff --git a/Cargo.toml b/Cargo.toml
index 2d79a9f..6b0f88e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,15 +20,15 @@ tokio02 = ["tokio02-crate"]
tokio03 = ["tokio03-crate"]
[dependencies]
-async-channel = "^1.5"
-async-executor = "^1.4"
-async-lock = "^2.5"
-blocking = "^1.2"
-futures-lite = "^1.0"
+async-chann... | 1 | 6 | 6 |
d897e28b24e9cad344dc7f0f4e1f7433e2142493 | Hugo Tunius | 2022-10-28T13:04:54 | Limit blocking dependency to 1.2
In executor.rs there's [code][0] that expects `blocking::unblock` to be sync
but in version prior to 1.2 it was `async.
[0]: https://github.com/async-rs/async-global-executor/blob/b5dcd0426deda80d26009436c5fe5418ee23c71a/src/executor.rs#L101 | diff --git a/Cargo.toml b/Cargo.toml
index 4990871..9e07417 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ tokio03 = ["tokio03-crate"]
async-channel = "^1.5"
async-executor = "^1.4"
async-lock = "^2.5"
-blocking = "^1.0"
+blocking = "^1.2"
futures-lite = "^1.0"
once_cell = "^1.4" | 1 | 1 | 1 |
77f27f0f6e9179addd7700574c7e406b7e96ed94 | Dirkjan Ochtman | 2022-06-13T09:03:04 | Bump version number to 2.2.0 | diff --git a/Cargo.toml b/Cargo.toml
index 851d56d..490b4da 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "2.1.0"
+version = "2.2.0"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
ca7beaa92c8b582de50b91baf0663299af662f6d | Dirkjan Ochtman | 2022-06-13T09:02:30 | Revert "edition 2021"
This reverts commit 036c540b0fec9e6864cde0f4b9af3c7d30acf055. | diff --git a/Cargo.toml b/Cargo.toml
index 3944048..851d56d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ name = "async-global-executor"
version = "2.1.0"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-executor and async-io"
-edition... | 1 | 1 | 1 |
036c540b0fec9e6864cde0f4b9af3c7d30acf055 | Marc-Antoine Perennou | 2022-05-29T08:22:43 | edition 2021
Our MSRV allows this now
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 5030552..83120a3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ name = "async-global-executor"
version = "2.0.4"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-executor and async-io"
-edition... | 1 | 1 | 1 |
cf8ca1d98630516f8743e586f2656b94542afc49 | John | 2022-05-29T06:21:19 | use async-lock instead of async-mutex (#8) | diff --git a/Cargo.toml b/Cargo.toml
index 4f6437c..f584064 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ tokio03 = ["tokio03-crate"]
[dependencies]
async-channel = "^1.5"
async-executor = "^1.4"
-async-mutex = "^1.4"
+async-lock = "^2.5"
blocking = "^1.0"
futures-lite = "^1.0"
num_cpus = "^1.13"
dif... | 2 | 2 | 2 |
22894e704e741e3fd4d01b0da95314bc48b96b51 | Mohammad AlSaleh | 2022-03-31T07:43:53 | spawn_blocking: Return concrete `Task<T>` type (#5)
The opaque return type makes storing that value not very useful.
And the function return type matches `spawn()` now.
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com> | diff --git a/src/executor.rs b/src/executor.rs
index c26a216..838fbd6 100644
--- a/src/executor.rs
+++ b/src/executor.rs
@@ -97,6 +97,6 @@ pub fn spawn_local<F: Future<Output = T> + 'static, T: 'static>(future: F) -> Ta
/// let out = async_global_executor::spawn_blocking(|| Command::new("dir").output()).await?;
/// #... | 1 | 2 | 2 |
d0a12a3b5388f8adec0116883f69ad72ecbe34df | Marc-Antoine Perennou | 2022-03-02T08:52:16 | v2.0.3
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index d2e2c75..708f592 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "2.0.2"
+version = "2.0.3"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
008c1dfa585d78070dac23ee774fd288a70415cd | Marc-Antoine Perennou | 2022-03-02T08:51:30 | config: update documentation
Fixes #4
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/config.rs b/src/config.rs
index 5f64ee8..e1d0b9e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -42,7 +42,9 @@ impl GlobalExecutorConfig {
self
}
- /// Use the specified value as the maximum number of threads.
+ /// Use the specified value as the maximum number of threads for a... | 1 | 3 | 1 |
d6a03a3151e05ed6b377fa0550f2a5867224adc5 | Marc-Antoine Perennou | 2021-01-11T14:16:49 | v2.0.2
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index adda6e5..d2e2c75 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "2.0.1"
+version = "2.0.2"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
b19d9bb584887b6c1d3a8ccf81b6179420c8e605 | surechen | 2021-01-11T07:44:13 | Fix small spelling mistake of GlobalExecutorConfig. (#3)
* Fix small spelling mistake
* Edit description for annotation of thread_name_fn. | diff --git a/src/config.rs b/src/config.rs
index ecad533..5f64ee8 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -15,7 +15,7 @@ pub struct GlobalExecutorConfig {
min_threads: Option<usize>,
/// The maximum number of threads to spawn.
max_threads: Option<usize>,
- /// The name to us fo the threads.
... | 1 | 1 | 1 |
48dd1c1d8aae902401d1db4345327b858288f6ac | Marc-Antoine Perennou | 2020-12-23T21:31:03 | blocking is not optional anymore
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 2114f15..63d4f38 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ categories = ["asynchronous", "concurrency"]
readme = "README.md"
[features]
-default = ["async-io", "blocking"]
+default = ["async-io"]
tokio = ["tokio-crate"]
tokio02 = ["tokio02-crate"]
tokio... | 1 | 2 | 5 |
d6af096f55ca4934efc6763cd85505a95f2ab238 | Marc-Antoine Perennou | 2020-12-23T20:57:34 | tokio 1.0 support
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 91520cc..7276d7a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,7 @@ readme = "README.md"
[features]
default = ["async-io", "blocking"]
+tokio = ["tokio-crate"]
tokio02 = ["tokio02-crate"]
tokio03 = ["tokio03-crate"]
@@ -33,6 +34,13 @@ optional = true
version =... | 4 | 53 | 0 |
fb0cead54be8edeb1d8a4dc9fd2f84d7d1028027 | Marc-Antoine Perennou | 2020-11-25T10:56:17 | rustfmt
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 9a385a2..088d085 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -33,7 +33,7 @@ doc_comment::doctest!("../README.md");
pub use async_executor::Task;
pub use config::GlobalExecutorConfig;
-pub use executor::{block_on, spawn, spawn_local, spawn_blocking};
+pub use executor::{blo... | 1 | 1 | 1 |
3d70526ce27884b30e44366ce2f75fd54e37abd4 | Marc-Antoine Perennou | 2020-11-25T10:03:47 | Revert "introduce a wrapper around Task"
This reverts commit 08779ff5d77ab1df608abeaf513743590d48b4f4.
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index e224eec..7633ff3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,5 +44,4 @@ default-features = false
features = ["rt", "rt-multi-thread"]
[dev-dependencies]
-async-io = "^1.2"
doc-comment = "^0.3"
diff --git a/src/executor.rs b/src/executor.rs
index 6bb2710..3f41eaa 10064... | 4 | 3 | 131 |
d0a8e72aa57c4013776658b9adc69fbea93a8197 | Marc-Antoine Perennou | 2020-11-25T09:41:27 | tokio: avoid spurious clone
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/tokio02.rs b/src/tokio02.rs
index 1d578fb..d4ff571 100644
--- a/src/tokio02.rs
+++ b/src/tokio02.rs
@@ -6,9 +6,7 @@ pub(crate) fn enter<F: FnOnce() -> R, R>(f: F) -> R {
}
static RUNTIME: Lazy<tokio::runtime::Handle> = Lazy::new(|| {
- if let Ok(handle) = tokio::runtime::Handle::try_current() {
... | 2 | 4 | 8 |
08779ff5d77ab1df608abeaf513743590d48b4f4 | Marc-Antoine Perennou | 2020-11-25T09:33:29 | introduce a wrapper around Task
and import docs from async-task
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 7633ff3..e224eec 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,4 +44,5 @@ default-features = false
features = ["rt", "rt-multi-thread"]
[dev-dependencies]
+async-io = "^1.2"
doc-comment = "^0.3"
diff --git a/src/executor.rs b/src/executor.rs
index c1a15eb..6bb2710 10064... | 5 | 134 | 5 |
e5edf54419c3cfc2c0ef8bf6985291425eeb7452 | Marc-Antoine Perennou | 2020-11-25T09:06:58 | tokio03: don't spawn a Runtime if there's already one
matching what we already do for tokio02
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 996f2a8..7633ff3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -38,7 +38,7 @@ features = ["rt-core"]
[dependencies.tokio03-crate]
package = "tokio"
-version = "^0.3"
+version = "^0.3.4"
optional = true
default-features = false
features = ["rt", "rt-multi-thread"]
diff --g... | 2 | 15 | 9 |
c712f434c329e8e1b4bf558e49306c19cc7b7762 | Marc-Antoine Perennou | 2020-11-10T16:44:46 | threading: avoid atomics in thread shutdown
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/threading.rs b/src/threading.rs
index 108b9ef..8506119 100644
--- a/src/threading.rs
+++ b/src/threading.rs
@@ -3,11 +3,7 @@ use async_executor::Task;
use async_mutex::Mutex;
use futures_lite::future;
use once_cell::sync::OnceCell;
-use std::{
- io,
- sync::atomic::{AtomicBool, Ordering},
- ... | 1 | 19 | 21 |
dec98c43dcbcce524377099b96b0c6343b627810 | Marc-Antoine Perennou | 2020-11-10T16:08:36 | threading: fix thread_main_loop termination
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/threading.rs b/src/threading.rs
index f4f1ed8..108b9ef 100644
--- a/src/threading.rs
+++ b/src/threading.rs
@@ -3,7 +3,11 @@ use async_executor::Task;
use async_mutex::Mutex;
use futures_lite::future;
use once_cell::sync::OnceCell;
-use std::{io, thread};
+use std::{
+ io,
+ sync::atomic::{Ato... | 1 | 37 | 9 |
253ff7b2213ceb005c5aef32d57a741daa8f3d81 | Marc-Antoine Perennou | 2020-11-09T14:37:49 | explode into modules
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/config.rs b/src/config.rs
new file mode 100644
index 0000000..ecad533
--- /dev/null
+++ b/src/config.rs
@@ -0,0 +1,95 @@
+use once_cell::sync::OnceCell;
+use std::{
+ fmt,
+ sync::atomic::{AtomicUsize, Ordering},
+};
+
+pub(crate) static GLOBAL_EXECUTOR_CONFIG: OnceCell<Config> = OnceCell::new();... | 6 | 364 | 361 |
2a1b461bfe044fc8bc5acb04de3be6831b9315ac | Marc-Antoine Perennou | 2020-11-09T14:23:32 | run localexecutor to completion
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 99104a9..996f2a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,14 +19,14 @@ tokio03 = ["tokio03-crate"]
[dependencies]
async-channel = "^1.5"
-async-executor = "^1.3"
+async-executor = "^1.4"
async-mutex = "^1.4"
futures-lite = "^1.0"
num_cpus = "^1.13"
once_cell = "... | 2 | 6 | 3 |
c9b10554625f731aa5c628941ac717829de2b40c | Marc-Antoine Perennou | 2020-11-05T20:22:51 | rework thread_name_fn
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index a8c5c81..14578ff 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -55,8 +55,6 @@ static GLOBAL_EXECUTOR_THREADS: Lazy<()> = Lazy::new(init);
static GLOBAL_EXECUTOR_THREADS_NUMBER: Mutex<usize> = Mutex::new(0);
// The expected number of threads (excluding the one that are shutting... | 1 | 14 | 12 |
21e34aab09a3af138ce0797dc75e36137c4543f3 | Marc-Antoine Perennou | 2020-11-05T14:23:30 | Return useful data from threads management functions
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 96a08b4..a8c5c81 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -264,12 +264,14 @@ pub fn init() {
/// Spawn more executor threads, up to configured max value.
///
+/// Returns how many threads we spawned.
+///
/// # Examples
///
/// ```
/// async_global_executor::spawn_m... | 1 | 14 | 5 |
cb48a01b397405049fa21c0333858b9066620c89 | Marc-Antoine Perennou | 2020-11-05T14:19:05 | add comments
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 0e14879..96a08b4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -51,14 +51,19 @@ pub use async_executor::Task;
static GLOBAL_EXECUTOR_CONFIG: OnceCell<Config> = OnceCell::new();
static GLOBAL_EXECUTOR_THREADS: Lazy<()> = Lazy::new(init);
+// The current number of threads (som... | 1 | 20 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.