1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 <2019> 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 <2019> 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: generalTime/epicsTimeGetCurrent and casr questions |
From: | William Layne via Tech-talk <[email protected]> |
To: | [email protected] |
Cc: | "Layne \(US\), William C" <[email protected]> |
Date: | Tue, 12 Mar 2019 08:06:38 -0400 |
Hi Casey,
On 3/8/19 4:18 PM, Layne (US), William C via Tech-talk wrote:
> am trying to narrow down which futex we are spending lots of time in
This got me thinking about how this would be done. Looking at glibc
I think the first argument of the futex() syscall is the __data.__lock
member of pthread_mutex_t.
https://github.com/bminor/glibc/blob/43b1048ab9418e902aac8c834a7a9a88c501620a/nptl/pthread_mutex_lock.c#L43
If I change epicsMutexOsdShow() in posix/osdThread.c to:
> void epicsMutexOsdShow(struct epicsMutexOSD * pmutex, unsigned int level)
> {
> #if defined(__linux__) && defined(__GLIBC__)
> /* GLIBC w/ NTPL is passing the &__lock as the first argument (UADDR)
> * of the futex() syscall.
> */
> printf(" pthread uaddr=%p\n", &pmutex->lock.__data.__lock);
> #endif
> }
and apply
https://github.com/epics-base/epics-base/commit/d1149a0ba90096b3aa2890029ed9a430216d96ec
then I think the uaddr value shown below can be matched to futex() calls.
(I couldn't find a quick way to check this)
> epics> epicsMutexShowAll 0 1
> ellCount(&mutexList) 56 ellCount(&freeList) 0
> epicsMutexId 0x55db1e6f90e0 source ..//iocsh/iocsh.cpp line 78
> pthread uaddr=0x55db1e6f90a0
> ...