aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_bp.h
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2010-05-11 20:14:09 +0200
committerRaimo Niskanen <[email protected]>2010-06-03 14:54:21 +0200
commit96a6c45d081e41dbe2d44a8d07d78b46d0e9f587 (patch)
treee715d1718e40b0361dd3bac2a4e11d27d84eba8c /erts/emulator/beam/beam_bp.h
parent9fd1b1794c6e582cccfdb946b225ccf7acc98c9d (diff)
downloadotp-96a6c45d081e41dbe2d44a8d07d78b46d0e9f587.tar.gz
otp-96a6c45d081e41dbe2d44a8d07d78b46d0e9f587.tar.bz2
otp-96a6c45d081e41dbe2d44a8d07d78b46d0e9f587.zip
Teach call count tracing to use atomics
Call count previously used a global lock for accessing and writing its counter in the breakpoint. This is now changed to atomics instead. The change will let call count tracing and cprof to scale better when increasing the number of schedulers.
Diffstat (limited to 'erts/emulator/beam/beam_bp.h')
-rw-r--r--erts/emulator/beam/beam_bp.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/erts/emulator/beam/beam_bp.h b/erts/emulator/beam/beam_bp.h
index b76e0c01e7..d22dd5de87 100644
--- a/erts/emulator/beam/beam_bp.h
+++ b/erts/emulator/beam/beam_bp.h
@@ -93,7 +93,7 @@ typedef struct bp_data_count { /* Call count */
struct bp_data *prev;
BeamInstr orig_instr;
BeamInstr this_instr; /* key */
- Sint count;
+ erts_smp_atomic_t acount;
} BpDataCount;
typedef struct {
@@ -152,11 +152,12 @@ ERTS_INLINE Uint bp_sched2ix(void);
#define bp_sched2ix_proc(p) (0)
#endif
-#define ErtsCountBreak(pc,instr_result) \
+#define ErtsCountBreak(p, pc,instr_result) \
do { \
BpData **bds = (BpData **) (pc)[-4]; \
BpDataCount *bdc = NULL; \
- Uint ix = bp_sched2ix(); \
+ Uint ix = bp_sched2ix_proc( (p) ); \
+ long count = 0; \
\
ASSERT((pc)[-5] == (BeamInstr) BeamOp(op_i_func_info_IaaI)); \
ASSERT(bds); \
@@ -164,17 +165,16 @@ do { \
bdc = (BpDataCount *) bdc->next; \
ASSERT(bdc); \
bds[ix] = (BpData *) bdc; \
- ErtsSmpBPLock(bdc); \
- if (bdc->count >= 0) bdc->count++; \
- ErtsSmpBPUnlock(bdc); \
+ count = erts_smp_atomic_read(&bdc->acount); \
+ if (count >= 0) erts_smp_atomic_inc(&bdc->acount); \
*(instr_result) = bdc->orig_instr; \
} while (0)
-#define ErtsBreakSkip(pc,instr_result) \
+#define ErtsBreakSkip(p, pc,instr_result) \
do { \
BpData **bds = (BpData **) (pc)[-4]; \
BpData *bd = NULL; \
- Uint ix = bp_sched2ix(); \
+ Uint ix = bp_sched2ix_proc( (p) ); \
\
ASSERT((pc)[-5] == (BeamInstr) BeamOp(op_i_func_info_IaaI)); \
ASSERT(bds); \