sim: Add a hook Clocked objects can implement for frequency changes.
sim: Add a hook Clocked objects can implement for frequency changes.

This hook will let them implement whatever additional behavior is
necessary for when the clock changes.

An alternative design for this might have made the "update" function
virtual, and required anyone overriding it to call into the base class.
I think that would be an inferior design for two reasons. First, the
subclass author might forget to call update. Second, while it might
*seem* like this would have some performance benefit since you wouldn't
call into the virtual function and then call update, incurring the
function call overhead twice, you're going to call into update once
regardless, and then you're either going to call the virtual funciton
which does nothing (the norm) or does something. In either case you
call the same functions the same number of times.

There may be a slight penalty in code size since the call to update
may be inlined in the call sights before the virtual function, and
there will almost certainly be more of those than there would be
implementations of the virtual function, but that should be negligable
when compared to gem5's size as a whole.

Change-Id: Id25a5359f2b1f7e42c6d1dcbc70a37d3ce092d38
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20089
Tested-by: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
Reviewed-by: Chun-Chen TK Hsu <91dcdfb9561c211c6d292d4179e3ae64e470601d@google.com>
Reviewed-by: Andreas Sandberg <c9f5686ee5bd561c93f9de79681eee75bfa7f36e@arm.com>
Reviewed-by: Anthony Gutierrez <fe4627c83134668039628e34eb0e4dda45a5da5e@amd.com>
Reviewed-by: Srikant Bharadwaj <7abd8a1e0eed8fe42789a2587ba3e2bbeb88f55b@amd.com>
Reviewed-by: Jason Lowe-Power <68c46a606457643eab92053c1c05574abb26f861@lowepower.com>
Maintainer: Andreas Sandberg <c9f5686ee5bd561c93f9de79681eee75bfa7f36e@arm.com>

gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5,gem5/gem5