statistics.cc (14205:197360deaa20) statistics.cc (14266:711b485a4bf8)
1/*
2 * Copyright (c) 2019 Arm Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

198 }
199
200 return true;
201}
202
203void
204Info::setName(const string &name)
205{
1/*
2 * Copyright (c) 2019 Arm Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

198 }
199
200 return true;
201}
202
203void
204Info::setName(const string &name)
205{
206 setName(nullptr, name);
207}
208
209void
210Info::setName(const Group *parent, const string &name)
211{
206 if (!validateStatName(name))
207 panic("invalid stat name '%s'", name);
208
212 if (!validateStatName(name))
213 panic("invalid stat name '%s'", name);
214
209 pair<NameMapType::iterator, bool> p =
210 nameMap().insert(make_pair(name, this));
215 // We only register the stat with the nameMap() if we are using
216 // old-style stats without a parent group. New-style stats should
217 // be unique since their names should correspond to a member
218 // variable.
219 if (!parent) {
220 auto p = nameMap().insert(make_pair(name, this));
211
221
212 Info *other = p.first->second;
213 bool result = p.second;
214
215 if (!result) {
216 // using other->name instead of just name to avoid a compiler
217 // warning. They should be the same.
218 panic("same statistic name used twice! name=%s\n", other->name);
222 if (!p.second)
223 panic("same statistic name used twice! name=%s\n",
224 name);
219 }
220
221 this->name = name;
222}
223
224bool
225Info::less(Info *stat1, Info *stat2)
226{

--- 358 unchanged lines hidden ---
225 }
226
227 this->name = name;
228}
229
230bool
231Info::less(Info *stat1, Info *stat2)
232{

--- 358 unchanged lines hidden ---