aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_db.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-10-11 23:34:49 +0200
committerSverker Eriksson <[email protected]>2018-10-23 12:36:28 +0200
commit129e61564807c0ad43faf9d0c36260c793501920 (patch)
tree26822017b645e14403c5e7989d9a4d536217e063 /erts/emulator/beam/erl_db.c
parent375a1f5c29fd2d3b537e117149e78b0ac61e263f (diff)
downloadotp-129e61564807c0ad43faf9d0c36260c793501920.tar.gz
otp-129e61564807c0ad43faf9d0c36260c793501920.tar.bz2
otp-129e61564807c0ad43faf9d0c36260c793501920.zip
erts: Add erts_debug feature 'ets_force_split'
to easier generate a routing tree for test without having to spend cpu to provoke actual repeated lock conflicts.
Diffstat (limited to 'erts/emulator/beam/erl_db.c')
-rw-r--r--erts/emulator/beam/erl_db.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_db.c b/erts/emulator/beam/erl_db.c
index 337efa94bd..df6f42edd3 100644
--- a/erts/emulator/beam/erl_db.c
+++ b/erts/emulator/beam/erl_db.c
@@ -4465,3 +4465,16 @@ void erts_lcnt_update_db_locks(int enable) {
#ifdef ETS_DBG_FORCE_TRAP
erts_aint_t erts_ets_dbg_force_trap = 0;
#endif
+
+int erts_ets_force_split(Eterm tid, int on)
+{
+ DbTable* tb = tid2tab(tid);
+ if (!tb || !IS_CATREE_TABLE(tb->common.type))
+ return 0;
+
+ db_lock(tb, LCK_WRITE);
+ if (!(tb->common.status & DB_DELETE))
+ db_catree_force_split(&tb->catree, on);
+ db_unlock(tb, LCK_WRITE);
+ return 1;
+}