Skip to content

Commit

Permalink
Remove useless OMR_THR_TRACING configuration option
Browse files Browse the repository at this point in the history
Enabling it wouldn't work: for example, it would offer
`omrthread_reset_tracing()` which couldn't exist.

Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
  • Loading branch information
keithc-ca committed Oct 25, 2021
1 parent a623525 commit 051232d
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 212 deletions.
3 changes: 1 addition & 2 deletions cmake/config.cmake
Expand Up @@ -198,8 +198,7 @@ if(OMR_THR_YIELD_ALG)
MESSAGE "OMR_THR_YIELD_ALG enabled, but not supported on current platform"
)
endif()
#TODO set to disabled. Stuff fails to compile when its on
set(OMR_THR_TRACING OFF CACHE BOOL "TODO: Document")
# TODO set to disabled. Stuff fails to compile when its on
set(OMR_THR_MCS_LOCKS OFF CACHE BOOL "Enable the usage of the MCS lock in the OMR thread monitor.")

#TODO this should maybe be a OMRTHREAD_LIB string variable?
Expand Down
26 changes: 2 additions & 24 deletions configure
Expand Up @@ -706,7 +706,6 @@ OMR_GC_MODRON_SCAVENGER
OMR_GC_MODRON_CONCURRENT_MARK
OMR_GC_MODRON_COMPACTION
OMR_GC_DYNAMIC_CLASS_UNLOADING
OMR_THR_TRACING
OMR_THR_LOCK_NURSERY
OMR_THR_JLM_HOLD_TIMES
OMR_THR_JLM
Expand Down Expand Up @@ -853,7 +852,6 @@ enable_OMR_THR_ADAPTIVE_SPIN
enable_OMR_THR_JLM
enable_OMR_THR_JLM_HOLD_TIMES
enable_OMR_THR_LOCK_NURSERY
enable_OMR_THR_TRACING
enable_OMR_GC_DYNAMIC_CLASS_UNLOADING
enable_OMR_GC_MODRON_COMPACTION
enable_OMR_GC_MODRON_CONCURRENT_MARK
Expand Down Expand Up @@ -1614,8 +1612,6 @@ Optional Features:
--disable-OMR_THR_LOCK_NURSERY
--enable-OMR_THR_TRACING
--enable-OMR_GC_DYNAMIC_CLASS_UNLOADING
--enable-OMR_GC_MODRON_COMPACTION
Expand Down Expand Up @@ -2879,8 +2875,8 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
OMR_COMPANY_NAME=${OMR_COMPANY_NAME:-""}
OMR_COMPANY_COPYRIGHT=${OMR_COMPANY_COPYRIGHT:-""}
OMR_PRODUCT_NAME=${OMR_PRODUCT_NAME:-"OMR"}
OMR_PRODUCT_DESCRIPTION=${OMR_PRODUCT_DESCRIPTION:-"OMR 0.1 "}
OMR_PRODUCT_NAME=${OMR_PRODUCT_NAME:-"OMR"}
OMR_PRODUCT_VERSION=${OMR_PRODUCT_VERSION:-"0.1"}
OMR_ZOS_COMPILE_ARCHITECTURE=${OMR_ZOS_COMPILE_ARCHITECTURE:-"7"}
Expand Down Expand Up @@ -5301,25 +5297,7 @@ fi
############### Flags that are always disabled
# Each flag must have a corresponding entry in omrcfg.h.in
# Check whether --enable-OMR_THR_TRACING was given.
if test "${enable_OMR_THR_TRACING+set}" = set; then :
enableval=$enable_OMR_THR_TRACING; if test "x${enableval}" = xyes; then :
OMR_THR_TRACING=1
$as_echo "#define OMR_THR_TRACING 1" >>confdefs.h
else
OMR_THR_TRACING=0
fi
else
OMR_THR_TRACING=0
fi
# (no flags are always disabled)
############### Flags that are conditionally enabled.
# Each flag must have a corresponding entry in omrcfg.h.in
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2015, 2020 IBM Corp. and others
# Copyright (c) 2015, 2021 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -412,7 +412,7 @@ OMRCFG_DEFINE_FLAG_ON([OMR_THR_LOCK_NURSERY])
############### Flags that are always disabled
# Each flag must have a corresponding entry in omrcfg.h.in

OMRCFG_DEFINE_FLAG_OFF([OMR_THR_TRACING])
# (no flags are always disabled)

############### Flags that are conditionally enabled.
# Each flag must have a corresponding entry in omrcfg.h.in
Expand Down
8 changes: 1 addition & 7 deletions include_core/omrcfg.cmake.h.in
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2020 IBM Corp. and others
* Copyright (c) 2017, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -105,12 +105,6 @@
*/
#cmakedefine OMR_THR_LOCK_NURSERY

/**
* Output lots of thread statistics (Pentium only)
* ifRemoved: Turn off in production VMs
*/
#cmakedefine OMR_THR_TRACING 1

#cmakedefine OMRTHREAD_LIB_AIX 1
#cmakedefine OMRTHREAD_LIB_UNIX 1
#cmakedefine OMRTHREAD_LIB_WIN32 1
Expand Down
8 changes: 1 addition & 7 deletions include_core/omrcfg.h.in
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2020 IBM Corp. and others
* Copyright (c) 2015, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -103,12 +103,6 @@
*/
#undef OMR_THR_LOCK_NURSERY

/**
* Output lots of thread statistics (Pentium only)
* ifRemoved: Turn off in production VMs
*/
#undef OMR_THR_TRACING

#undef OMRTHREAD_LIB_AIX
#undef OMRTHREAD_LIB_UNIX
#undef OMRTHREAD_LIB_WIN32
Expand Down
45 changes: 1 addition & 44 deletions include_core/thread_api.h
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -499,16 +499,6 @@ void
omrthread_detach(omrthread_t thread);


#if (defined(OMR_THR_TRACING))
/**
* @brief
* @param thread
* @return void
*/
void
omrthread_dump_trace(omrthread_t thread);
#endif /* OMR_THR_TRACING */

/**
* @brief
* @param monitor
Expand Down Expand Up @@ -746,28 +736,6 @@ void
omrthread_monitor_flush_destroyed_monitor_list(omrthread_t self);


#if (defined(OMR_THR_TRACING))
/**
* @brief
* @param void
* @return void
*/
void
omrthread_monitor_dump_all(void);
#endif /* OMR_THR_TRACING */


#if (defined(OMR_THR_TRACING))
/**
* @brief
* @param monitor
* @return void
*/
void
omrthread_monitor_dump_trace(omrthread_monitor_t monitor);
#endif /* OMR_THR_TRACING */


/**
* @brief
* @param monitor
Expand Down Expand Up @@ -984,17 +952,6 @@ uintptr_t
omrthread_priority_interrupted(omrthread_t thread);


#if (defined(OMR_THR_TRACING))
/**
* @brief
* @param void
* @return void
*/
void
omrthread_reset_tracing(void);
#endif /* OMR_THR_TRACING */


/**
* @brief
* @param thread
Expand Down
3 changes: 1 addition & 2 deletions omrmakefiles/configure.mk.in
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2015, 2020 IBM Corp. and others
# Copyright (c) 2015, 2021 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -96,7 +96,6 @@ OMR_THR_JLM := @OMR_THR_JLM@
OMR_THR_JLM_HOLD_TIMES := @OMR_THR_JLM_HOLD_TIMES@
OMR_THR_LOCK_NURSERY := @OMR_THR_LOCK_NURSERY@
OMR_THR_THREE_TIER_LOCKING := @OMR_THR_THREE_TIER_LOCKING@
OMR_THR_TRACING := @OMR_THR_TRACING@
OMR_THR_YIELD_ALG := @OMR_THR_YIELD_ALG@
OMR_THR_SPIN_WAKE_CONTROL := @OMR_THR_SPIN_WAKE_CONTROL@
OMR_THR_MCS_LOCKS := @OMR_THR_MCS_LOCKS@
Expand Down
102 changes: 3 additions & 99 deletions thread/common/omrthread.c
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2019 IBM Corp. and others
* Copyright (c) 1991, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -2059,7 +2059,7 @@ copyAttr(omrthread_attr_t *attrTo, const omrthread_attr_t *attrFrom)
}

return rc;

destroyAttr:
omrthread_attr_destroy((omrthread_attr_t *)&attrTo);
copyAttrDone:
Expand Down Expand Up @@ -2156,10 +2156,6 @@ threadDestroy(omrthread_t thread, int globalAlreadyLocked)
free_mcs_nodes(thread->library, thread->mcsNodes);
#endif /* defined(OMR_THR_MCS_LOCKS) */

#ifdef OMR_THR_TRACING
omrthread_dump_trace(thread);
#endif

#if defined(OMR_OS_WINDOWS)
/* Acquire the global monitor mutex (if needed) while performing handle closing and freeing. */
if (!globalAlreadyLocked) {
Expand Down Expand Up @@ -3440,10 +3436,6 @@ omrthread_monitor_destroy(omrthread_monitor_t monitor)

GLOBAL_LOCK(self, CALLER_MONITOR_DESTROY);

#if defined(OMR_THR_TRACING)
omrthread_monitor_dump_trace(monitor);
#endif /* defined(OMR_THR_TRACING) */

if (monitor->owner || monitor_maximum_wait_number(monitor)) {
/* This monitor is in use! It was probably abandoned when a thread was cancelled.
* There's actually a very small timing hole here -- if the thread had just locked the
Expand Down Expand Up @@ -3482,10 +3474,6 @@ omrthread_monitor_destroy_nolock(omrthread_t self, omrthread_monitor_t monitor)
ASSERT(self);
ASSERT(monitor);

#if defined(OMR_THR_TRACING)
omrthread_monitor_dump_trace(monitor);
#endif /* defined(OMR_THR_TRACING) */

if (monitor->owner || monitor_maximum_wait_number(monitor)) {
/* This monitor is in use! It was probably abandoned when a thread was cancelled.
* There's actually a very small timing hole here -- if the thread had just locked the
Expand Down Expand Up @@ -3553,7 +3541,7 @@ static omrthread_monitor_t
monitor_allocate(omrthread_t self, intptr_t policy, intptr_t policyData)
{
omrthread_monitor_t newMonitor = NULL;
omrthread_library_t lib = NULL;
omrthread_library_t lib = NULL;
omrthread_monitor_pool_t pool = NULL;
intptr_t rc = 0;

Expand Down Expand Up @@ -5413,34 +5401,6 @@ free_monitor_pools(void)
lib->monitor_pool = 0;
}


#if (defined(OMR_THR_TRACING))
/**
* Dump information about a monitor to stderr
*
* @param[in] monitor monitor to be dumped (non-NULL)
* @return none
*
* @see omrthread_monitor_dump_all
*/
void
omrthread_monitor_dump_trace(omrthread_monitor_t monitor)
{
fprintf(stderr,
"<thr_mon: %s enter=%u hold=%u exit=%u hldtm=%I64d blktm=%I64d>\n",
monitor->tracing.monitor_name
? monitor->tracing.monitor_name
: ((monitor->flags & J9THREAD_MONITOR_OBJECT) ? "(object)" : "(null)"),
monitor->tracing.enter_count,
monitor->tracing.hold_count,
monitor->tracing.exit_count,
monitor->tracing.holdtime_sum,
0);
fflush(stderr);
}

#endif /* OMR_THR_TRACING */

#if defined(OMR_THR_MCS_LOCKS)
/**
* Create and initialize an OMRThreadMCSNodes structure.
Expand Down Expand Up @@ -5487,62 +5447,6 @@ free_mcs_nodes(omrthread_library_t lib, omrthread_mcs_nodes_t mcsNodes)
}
#endif /* defined(OMR_THR_MCS_LOCKS) */

#if (defined(OMR_THR_TRACING))
/**
* Dump information about all monitors currently in use.
*
* @return none
* @see omrthread_monitor_dump_trace
*/
void
omrthread_monitor_dump_all(void)
{
omrthread_monitor_t monitor = NULL;
omrthread_monitor_walk_state_t walkState;
omrthread_monitor_init_walk(&walkState);

while (NULL != (monitor = omrthread_monitor_walk(&walkState))) {
omrthread_monitor_dump_trace(monitor);
}

}

#endif /* OMR_THR_TRACING */


#if (defined(OMR_THR_TRACING))
/**
* @internal
*
* Dump a thread's tracing values to stderr.
*
* @param[in] thread thread with tracing values to dump
* @return none
*/
void
omrthread_dump_trace(omrthread_t thread)
{
int i;
fprintf(stderr,
"<thr_thr: id=%p createtime=%I64d now=%I64d holdtime=%I64d>\n",
thread,
thread->tracing.createtime,
GetCycles(),
thread->tracing.holdtime);
for (i = 0; i < sizeof(thread->tracing.count) / sizeof(thread->tracing.count[0]); i++) {
fprintf(stderr,
"<thr_lock: id=%p location=%2d count=%u time=%I64d>\n",
thread,
i + 1,
thread->tracing.count[i],
thread->tracing.gettime[i]);
}
fflush(stderr);
}

#endif /* OMR_THR_TRACING */


/**
* Check if the current awakened thread was a target for a notify request.
*
Expand Down
12 changes: 1 addition & 11 deletions thread/exports.cmake
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2019, 2019 IBM Corp. and others
# Copyright (c) 2019, 2021 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -186,16 +186,6 @@ if(OMR_THR_ADAPTIVE_SPIN)
)
endif()


if(OMR_THR_TRACING)
omr_add_exports(j9thr_obj
omrthread_monitor_dump_trace
omrthread_monitor_dump_all
omrthread_dump_trace
omrthread_reset_tracing
)
endif()

# also apply the exports to j9thrstatic
get_target_property(thread_exports j9thr_obj EXPORTED_SYMBOLS)
omr_add_exports(j9thrstatic ${thread_exports})

0 comments on commit 051232d

Please sign in to comment.