aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_msacc.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2015-07-16 11:27:00 +0200
committerLukas Larsson <[email protected]>2016-02-02 10:45:22 +0100
commit0399f5fc547ef035c4eb5e383f30b28ae73d936e (patch)
treee4179769e6a09cc6de68f5226671fb403b5ef4e2 /erts/emulator/beam/erl_msacc.c
parentdc1e3933e633d9d7527e6df044895d12d3845e14 (diff)
downloadotp-0399f5fc547ef035c4eb5e383f30b28ae73d936e.tar.gz
otp-0399f5fc547ef035c4eb5e383f30b28ae73d936e.tar.bz2
otp-0399f5fc547ef035c4eb5e383f30b28ae73d936e.zip
erts: Refactor perf counter internal interface
perf counter is now part of the function pointer interface and also the function returns the value instead of writing to a memory buffer.
Diffstat (limited to 'erts/emulator/beam/erl_msacc.c')
-rw-r--r--erts/emulator/beam/erl_msacc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_msacc.c b/erts/emulator/beam/erl_msacc.c
index bf1c06dea7..71e3fd8b6e 100644
--- a/erts/emulator/beam/erl_msacc.c
+++ b/erts/emulator/beam/erl_msacc.c
@@ -117,7 +117,7 @@ void erts_msacc_init_thread(char *type, int id, int managed) {
#ifdef ERTS_MSACC_ALWAYS_ON
ERTS_MSACC_TSD_SET(msacc);
- sys_perf_counter(&msacc->perf_counter);
+ msacc->perf_counter = erts_sys_perf_counter();
msacc->state = ERTS_MSACC_STATE_OTHER;
#endif
}
@@ -278,7 +278,7 @@ reply_msacc(void *vmsaccrp)
if (msaccrp->action == ERTS_MSACC_ENABLE && !msacc) {
msacc = get_msacc();
- sys_perf_counter(&msacc->perf_counter);
+ msacc->perf_counter = erts_sys_perf_counter();
msacc->state = ERTS_MSACC_STATE_OTHER;
@@ -412,9 +412,9 @@ erts_msacc_request(Process *c_p, int action, Eterm *threads)
for (i = 0; i < unmanaged_count; i++) {
erts_mtx_lock(&unmanaged[i]->mtx);
if (unmanaged[i]->perf_counter) {
- ErtsSysHrTime perf_counter;
+ ErtsSysPerfCounter perf_counter;
/* if enabled update stats */
- sys_perf_counter(&perf_counter);
+ perf_counter = erts_sys_perf_counter();
unmanaged[i]->perf_counters[unmanaged[i]->state] +=
perf_counter - unmanaged[i]->perf_counter;
unmanaged[i]->perf_counter = perf_counter;
@@ -439,7 +439,7 @@ erts_msacc_request(Process *c_p, int action, Eterm *threads)
erts_rwmtx_rlock(&msacc_mutex);
for (msacc = msacc_unmanaged; msacc != NULL; msacc = msacc->next) {
erts_mtx_lock(&msacc->mtx);
- sys_perf_counter(&msacc->perf_counter);
+ msacc->perf_counter = erts_sys_perf_counter();
/* we assume the unmanaged thread is sleeping */
msacc->state = ERTS_MSACC_STATE_SLEEP;
erts_mtx_unlock(&msacc->mtx);
@@ -448,12 +448,12 @@ erts_msacc_request(Process *c_p, int action, Eterm *threads)
break;
}
case ERTS_MSACC_DISABLE: {
- ErtsSysHrTime perf_counter;
+ ErtsSysPerfCounter perf_counter;
erts_rwmtx_rlock(&msacc_mutex);
/* make sure to update stats with latest results */
for (msacc = msacc_unmanaged; msacc != NULL; msacc = msacc->next) {
erts_mtx_lock(&msacc->mtx);
- sys_perf_counter(&perf_counter);
+ perf_counter = erts_sys_perf_counter();
msacc->perf_counters[msacc->state] += perf_counter - msacc->perf_counter;
msacc->perf_counter = 0;
erts_mtx_unlock(&msacc->mtx);