python: Fix `get_simstat` func for non-Root SimObject case

The `get_simstat` function in `src/python/m5/stats/gem5stats.py` was
returning an error when a non-Root Simobject was passed:

```
AttributeError: object 'PyTrafficGen' has no attribute 'name'
At:
  build/NULL_MESI_Two_Level/python/m5/SimObject.py(1430): __getattr__
  build/NULL_MESI_Two_Level/python/m5/stats/gem5stats.py(279): get_simstat
```

The issue was an assumption that SimObjects have a field `name`. They
do not. To get a SimObject's name the `get_name()` function must be
used. This patch fixes this issue.

In addition to this fix, the documentation in this function has been
improved to state more clearly what can be passed  and what shall be
returned. Previously it was somewhat unclear.

Change-Id: I33538120015280bb6260ccf8eba6b75ff43d280e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54943
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
1 file changed