astobj2: Record lock usage to refs log when DEBUG_THREADS is enabled.

When DEBUG_THREADS is enabled we can know if the astobj2 mutex / rwlock
was ever used, so it can be recorded in the REF_DEBUG destructor entry.

Create contrib/scripts/reflocks.py to process locking used by
allocator.  This can be used to identify places where
AO2_ALLOC_OPT_LOCK_NOLOCK should be used to reduce memory usage.

Change-Id: I2e3cd23336a97df2692b545f548fd79b14b53bf4
This commit is contained in:
Corey Farrell
2018-10-01 00:11:44 -04:00
parent 5a9230eacb
commit 693e00eee6
3 changed files with 157 additions and 2 deletions

View File

@@ -108,6 +108,10 @@ def process_file(options):
else:
current_objects[obj]['curcount'] += int(parsed_line['delta'])
if 'destructor' in parsed_line['state']:
# refcounter.py doesn't care about lock-state.
parsed_line['state'] = '**destructor**'
current_objects[obj]['log'].append(
"[%s] %s:%s %s: %s %s - [%s]" % (
parsed_line['thread_id'],