@@ -28,18 +28,11 @@ Statman& Statman::get() {
2828
2929// /////////////////////////////////////////////////////////////////////////////
3030Stat::Stat (const Stat_type type, const std::string& name)
31- : type_{type}
31+ : ui64( 0 ), type_{type}
3232{
3333 if (name.size () > MAX_NAME_LEN)
3434 throw Stats_exception{" Creating stat: Name cannot be longer than " + std::to_string (MAX_NAME_LEN) + " characters" };
3535
36- switch (type) {
37- case UINT32: ui32 = 0 ; break ;
38- case UINT64: ui64 = 0 ; break ;
39- case FLOAT: f = 0 .0f ; break ;
40- default : throw Stats_exception{" Unimplemented stat type" };
41- }
42-
4336 snprintf (name_, sizeof (name_), " %s" , name.c_str ());
4437}
4538
@@ -79,7 +72,7 @@ uint64_t& Stat::get_uint64() {
7972void Statman::init (const uintptr_t start, const Size_type num_bytes)
8073{
8174 if (num_bytes < 0 )
82- throw Stats_exception{ " Creating Statman: A negative number of bytes has been given " } ;
75+ throw Stats_exception ( " Can't initialize statman with negative size " ) ;
8376
8477 const int N = num_bytes / sizeof (Stat);
8578 this ->stats_ = reinterpret_cast <Stat*>(start);
@@ -103,7 +96,7 @@ Stat& Statman::create(const Stat::Stat_type type, const std::string& name) {
10396 volatile scoped_spinlock lock (this ->stlock );
10497#endif
10598 if (name.empty ())
106- throw Stats_exception{ " Cannot create Stat with no name" } ;
99+ throw Stats_exception ( " Cannot create Stat with no name" ) ;
107100
108101 const int idx = bitmap.first_free ();
109102 if (idx == -1 || idx >= capacity ())
0 commit comments