summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/alpha_tru64_process.cc2
-rw-r--r--base/inifile.cc3
-rw-r--r--base/statistics.cc2
-rw-r--r--base/statistics.hh28
-rw-r--r--dev/disk_image.cc4
-rw-r--r--test/Makefile2
-rw-r--r--test/stattest.cc7
7 files changed, 32 insertions, 16 deletions
diff --git a/arch/alpha/alpha_tru64_process.cc b/arch/alpha/alpha_tru64_process.cc
index f411e594d..ccf4d4d6c 100644
--- a/arch/alpha/alpha_tru64_process.cc
+++ b/arch/alpha/alpha_tru64_process.cc
@@ -629,7 +629,7 @@ class Tru64 {
// just pass basep through uninterpreted.
TypedBufferArg<int64_t> basep(tgt_basep);
basep.copyIn(xc->mem);
- ::off_t host_basep = (off_t)*basep;
+ long host_basep = (off_t)*basep;
int host_result = getdirentries(fd, host_buf, tgt_nbytes, &host_basep);
// check for error
diff --git a/base/inifile.cc b/base/inifile.cc
index 2717a534d..74d47204e 100644
--- a/base/inifile.cc
+++ b/base/inifile.cc
@@ -35,6 +35,9 @@
#include <sys/types.h>
#include <sys/wait.h>
+#if defined(__OpenBSD__)
+#include <libgen.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/base/statistics.cc b/base/statistics.cc
index 726ea3c60..81b8856ca 100644
--- a/base/statistics.cc
+++ b/base/statistics.cc
@@ -344,7 +344,7 @@ StatData::less(StatData *stat1, StatData *stat2)
}
bool
-StatData::check() const
+StatData::baseCheck() const
{
if (!init) {
#ifdef STAT_DEBUG
diff --git a/base/statistics.hh b/base/statistics.hh
index ed3278e4a..3fc019edc 100644
--- a/base/statistics.hh
+++ b/base/statistics.hh
@@ -184,7 +184,8 @@ struct StatData
* use
* @return true for success
*/
- virtual bool check() const;
+ virtual bool check() const = 0;
+ bool baseCheck() const;
/**
* Checks if the first stat's name is alphabetically less than the second.
@@ -215,6 +216,7 @@ class ScalarData : public ScalarDataBase
ScalarData(T &stat) : s(stat) {}
virtual bool binned() const { return s.binned(); }
+ virtual bool check() const { return s.check(); }
virtual result_t val() const { return s.val(); }
virtual result_t total() const { return s.total(); }
virtual void reset() { s.reset(); }
@@ -254,6 +256,7 @@ class VectorData : public VectorDataBase
VectorData(T &stat) : s(stat) {}
virtual bool binned() const { return s.binned(); }
+ virtual bool check() const { return s.check(); }
virtual bool zero() const { return s.zero(); }
virtual void reset() { s.reset(); }
@@ -309,6 +312,7 @@ class DistData : public DistDataBase
DistData(T &stat) : s(stat) {}
virtual bool binned() const { return s.binned(); }
+ virtual bool check() const { return s.check(); }
virtual void reset() { s.reset(); }
virtual bool zero() const { return s.zero(); }
virtual void update() { return s.update(this); }
@@ -348,6 +352,7 @@ class VectorDistData : public VectorDistDataBase
VectorDistData(T &stat) : s(stat) {}
virtual bool binned() const { return T::bin_t::binned; }
+ virtual bool check() const { return s.check(); }
virtual void reset() { s.reset(); }
virtual size_t size() const { return s.size(); }
virtual bool zero() const { return s.zero(); }
@@ -388,12 +393,13 @@ class Vector2dData : public Vector2dDataBase
Vector2dData(T &stat) : s(stat) {}
virtual bool binned() const { return T::bin_t::binned; }
+ virtual bool check() const { return s.check(); }
virtual void reset() { s.reset(); }
virtual bool zero() const { return s.zero(); }
virtual void update()
{
Vector2dDataBase::update();
- return s.update(this);
+ s.update(this);
}
};
@@ -854,6 +860,8 @@ class ScalarBase : public DataAccess
*/
bool binned() const { return bin_t::binned; }
+ bool check() const { return bin.initialized(); }
+
/**
* Reset stat value to default
*/
@@ -963,7 +971,7 @@ class VectorBase : public DataAccess
return false;
}
- bool check() const { return true; }
+ bool check() const { return bin.initialized(); }
void reset() { bin.reset(); }
public:
@@ -1167,8 +1175,6 @@ class Vector2dBase : public DataAccess
void update(Vector2dDataBase *data)
{
- data->x = x;
- data->y = y;
int size = this->size();
data->vec.resize(size);
for (int i = 0; i < size; ++i)
@@ -1188,7 +1194,7 @@ class Vector2dBase : public DataAccess
*/
void reset() { bin.reset(); }
- bool check() { return true; }
+ bool check() { return bin.initialized(); }
};
template <typename T, template <typename T> class Storage, class Bin>
@@ -1665,7 +1671,7 @@ class DistBase : public DataAccess
bin.reset();
}
- bool check() { return true; }
+ bool check() { return bin.initialized(); }
};
template <typename T, template <typename T> class Storage, class Bin>
@@ -1718,7 +1724,7 @@ class VectorDistBase : public DataAccess
*/
void reset() { bin.reset(); }
- bool check() { return true; }
+ bool check() { return bin.initialized(); }
void update(VectorDistDataBase *base)
{
int size = this->size();
@@ -2509,8 +2515,8 @@ class Vector2d : public WrapVec2d<Vector2d<T, Bin>, Vector2dBase<T, StatStor, Bi
{
public:
Vector2d &init(size_t _x, size_t _y) {
- x = _x;
- y = _y;
+ statData()->x = x = _x;
+ statData()->y = y = _y;
bin.init(x * y, params);
setInit();
@@ -2732,6 +2738,8 @@ class FormulaBase : public DataAccess
*/
bool binned() const;
+ bool check() const { return true; }
+
/**
* Formulas don't need to be reset
*/
diff --git a/dev/disk_image.cc b/dev/disk_image.cc
index cbcd16a25..02c8b50b6 100644
--- a/dev/disk_image.cc
+++ b/dev/disk_image.cc
@@ -109,7 +109,7 @@ RawDiskImage::read(uint8_t *data, off_t offset) const
if (stream.seekg(offset * SectorSize, ios::beg) < 0)
panic("Could not seek to location in file");
- off_t pos = stream.tellg();
+ streampos pos = stream.tellg();
stream.read((char *)data, SectorSize);
DPRINTF(DiskImageRead, "read: offset=%d\n", (uint64_t)offset);
@@ -136,7 +136,7 @@ RawDiskImage::write(const uint8_t *data, off_t offset)
DPRINTF(DiskImageWrite, "write: offset=%d\n", (uint64_t)offset);
DDUMP(DiskImageWrite, data, SectorSize);
- off_t pos = stream.tellp();
+ streampos pos = stream.tellp();
stream.write((const char *)data, SectorSize);
return stream.tellp() - pos;
}
diff --git a/test/Makefile b/test/Makefile
index 29d252df4..ceb3c9a1c 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -52,7 +52,7 @@ offtest: offtest.o
rangetest: rangetest.o str.o
$(CXX) $(LFLAGS) -o $@ $^
-stattest: cprintf.o hostinfo.o misc.o sim_time.o statistics.o stattest.o str.o
+stattest: cprintf.o hostinfo.o misc.o statistics.o stattest.o str.o
$(CXX) $(LFLAGS) -o $@ $^
strnumtest: strnumtest.o str.o
diff --git a/test/stattest.cc b/test/stattest.cc
index dea5295cc..7c171be80 100644
--- a/test/stattest.cc
+++ b/test/stattest.cc
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
s13.init(4, 0, 99, 10);
s14.init(9);
s15.init(10);
- s16.init(2, 2);
+ s16.init(2, 9);
s1
.name("Stat01")
@@ -271,6 +271,11 @@ main(int argc, char *argv[])
s16[0][0] = 2;
s16[1][1] = 9;
s16[1][1] += 9;
+ s16[1][8] += 8;
+ s16[1][7] += 7;
+ s16[1][6] += 6;
+ s16[1][5] += 5;
+ s16[1][4] += 4;
s11 = 1;
s3 = 9;