Skip to content

Commit

Permalink
Squashed 'hdrhistogram/' changes from b0d0b54..92f5120
Browse files Browse the repository at this point in the history
92f5120 Merge pull request #21 from baruch/build-fixes
aede521 Fix build issues
d93124c Merge pull request #19 from baruch/baruch-fixes

git-subtree-dir: hdrhistogram
git-subtree-split: 92f5120d6fb7650c262def91b395fb8cf7f5ab7c
  • Loading branch information
baruch committed Oct 12, 2015
1 parent 1423299 commit ab25a6e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/hdr_histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ void hdr_reset_internal_counters(struct hdr_histogram* h)
int min_non_zero_index = -1;
int max_index = -1;
int64_t observed_total_count = 0;
int i;

for (int i = 0; i < h->counts_len; i++)
for (i = 0; i < h->counts_len; i++)
{
int64_t count_at_index;

Expand Down
12 changes: 8 additions & 4 deletions src/hdr_histogram_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ int hdr_encode_compressed(
}

int data_index = 0;
for (int i = 0; i < counts_limit;)
int i;
for (i = 0; i < counts_limit;)
{
int64_t value = h->counts[i];
i++;
Expand Down Expand Up @@ -315,23 +316,26 @@ void hdr_reset_internal_counters(struct hdr_histogram* h);

static void _apply_to_counts_16(struct hdr_histogram* h, const int16_t* counts_data, const int32_t counts_limit)
{
for (int i = 0; i < counts_limit; i++)
int i;
for (i = 0; i < counts_limit; i++)
{
h->counts[i] = be16toh(counts_data[i]);
}
}

static void _apply_to_counts_32(struct hdr_histogram* h, const int32_t* counts_data, const int32_t counts_limit)
{
for (int i = 0; i < counts_limit; i++)
int i;
for (i = 0; i < counts_limit; i++)
{
h->counts[i] = be32toh(counts_data[i]);
}
}

static void _apply_to_counts_64(struct hdr_histogram* h, const int64_t* counts_data, const int32_t counts_limit)
{
for (int i = 0; i < counts_limit; i++)
int i;
for (i = 0; i < counts_limit; i++)
{
h->counts[i] = be64toh(counts_data[i]);
}
Expand Down
9 changes: 6 additions & 3 deletions test/hdr_histogram_log_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ static void load_histograms()
hdr_alloc(INT64_C(3600) * 1000 * 1000, 3, &raw_histogram);
hdr_alloc(INT64_C(3600) * 1000 * 1000, 3, &cor_histogram);

for (int i = 0; i < 10000; i++)
int i;
for (i = 0; i < 10000; i++)
{
hdr_record_value(raw_histogram, 1000);
hdr_record_corrected_value(cor_histogram, 1000, 10000);
Expand Down Expand Up @@ -298,7 +299,8 @@ static char* test_encode_and_decode_compressed_large()
hdr_init(1, limit, 4, &expected);
srand(5);

for (int i = 0; i < 8070; i++)
int i;
for (i = 0; i < 8070; i++)
{
hdr_record_value(expected, rand() % limit);
}
Expand Down Expand Up @@ -633,7 +635,8 @@ static char* test_string_encode_decode()
struct hdr_histogram *histogram, *hdr_new = NULL;
hdr_alloc(INT64_C(3600) * 1000 * 1000, 3, &histogram);

for (int i = 1; i < 100; i++)
int i;
for (i = 1; i < 100; i++)
{
hdr_record_value(histogram, i*i);
}
Expand Down
6 changes: 4 additions & 2 deletions test/hdr_histogram_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ int main()
setlocale(LC_NUMERIC, "");
int64_t iterations = 400000000;

for (int i = 0; i < 100; i++)
int i;
for (i = 0; i < 100; i++)
{
int64_t j;
hdr_gettime(&t0);
for (int64_t j = 1; j < iterations; j++)
for (j = 1; j < iterations; j++)
{
hdr_record_value(histogram, j);
}
Expand Down

0 comments on commit ab25a6e

Please sign in to comment.