Skip to content

Commit

Permalink
test and fix for #67
Browse files Browse the repository at this point in the history
  • Loading branch information
ahueck committed Apr 8, 2021
1 parent 9a4e7e2 commit a3c27c4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/runtime/AccessCounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,18 @@ inline void updateMax(std::atomic<T>& maxVal, T newVal) noexcept {
}

struct CounterStats {
private:
CounterStats(double sum, double min, double max, double mean, double std)
: sum(sum), minVal(min), maxVal(max), meanVal(mean), stdVal(std) {
}

CounterStats() = default;

public:
static CounterStats create(const std::vector<Counter>& vals) {
if (vals.empty()) {
return CounterStats{};
}
unsigned n = vals.size();
double sum = std::accumulate(vals.begin(), vals.end(), 0.0);
double mean = sum / n;
Expand All @@ -56,10 +67,6 @@ struct CounterStats {
return CounterStats(sum, min, max, mean, std);
}

CounterStats(double sum, double min, double max, double mean, double std)
: sum(sum), minVal(min), maxVal(max), meanVal(mean), stdVal(std) {
}

const double sum{0};
const double minVal{0};
const double maxVal{0};
Expand Down
22 changes: 22 additions & 0 deletions test/runtime/40_ret_addr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// RUN: %run %s --manual 2>&1 | FileCheck %s

#include "../../lib/runtime/CallbackInterface.h"
#include "util.h"

#include <stdio.h>
#include <stdlib.h>


int main(int argc, char** argv) {
const void* ret_check=NULL;
const void* addr = 1;

typeart_get_return_address(addr, &ret_check);
if(ret_check != NULL){
fprintf(stderr,"[Error] Ret address mismatch expected NULL but have %p\n", ret_check);
}
return 0;
}

// CHECK-NOT: [Error]

0 comments on commit a3c27c4

Please sign in to comment.