Histogram.cc (9497:2759161b9d7f) Histogram.cc (9773:915be89faf30)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
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;

--- 110 unchanged lines hidden (view full) ---

119}
120
121void
122Histogram::add(Histogram& hist)
123{
124 uint32_t t_bins = m_data.size();
125
126 if (hist.getBins() != t_bins) {
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
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;

--- 110 unchanged lines hidden (view full) ---

119}
120
121void
122Histogram::add(Histogram& hist)
123{
124 uint32_t t_bins = m_data.size();
125
126 if (hist.getBins() != t_bins) {
127 fatal("Histograms with different number of bins cannot be combined!");
127 if (m_count == 0) {
128 m_data.resize(hist.getBins());
129 } else {
130 fatal("Histograms with different number of bins "
131 "cannot be combined!");
132 }
128 }
129
130 m_max = max(m_max, hist.getMax());
131 m_count += hist.size();
132 m_sumSamples += hist.getTotal();
133 m_sumSquaredSamples += hist.getSquaredTotal();
134
135 // Both histograms are log base 2.

--- 96 unchanged lines hidden ---
133 }
134
135 m_max = max(m_max, hist.getMax());
136 m_count += hist.size();
137 m_sumSamples += hist.getTotal();
138 m_sumSquaredSamples += hist.getSquaredTotal();
139
140 // Both histograms are log base 2.

--- 96 unchanged lines hidden ---