1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 36 unchanged lines hidden (view full) --- 45* VectorStandardDeviation totals 46* Document Namespaces 47*/ 48#ifndef __BASE_STATISTICS_HH__ 49#define __BASE_STATISTICS_HH__ 50 51#include <algorithm> 52#include <cassert> |
53#ifdef __SUNPRO_CC 54#include <math.h> 55#endif |
56#include <cmath> 57#include <functional> 58#include <iosfwd> 59#include <string> 60#include <vector> 61 62#include "base/cprintf.hh" 63#include "base/intmath.hh" --- 1344 unchanged lines hidden (view full) --- 1408 */ 1409 void sample(Counter val, int number, const Params ¶ms) 1410 { 1411 if (val < params.min) 1412 underflow += number; 1413 else if (val > params.max) 1414 overflow += number; 1415 else { |
1416 int index = (int)std::floor((val - params.min) / params.bucket_size); |
1417 assert(index < size(params)); 1418 cvec[index] += number; 1419 } 1420 1421 if (val < min_val) 1422 min_val = val; 1423 1424 if (val > max_val) --- 1466 unchanged lines hidden --- |