SQLite

Check-in [e60cb6d885]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enhance a debugging log message to better identify a mutex.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | debug
Files: files | file ages | folders
SHA1: e60cb6d8852ebf42659c7f2e86a1f6a2492b4664
User & Date: dan 2016-07-29 14:31:30.854
Context
2016-07-29
16:32
Turn memory status off by default. (check-in: ea3c7162dc user: drh tags: debug)
14:31
Enhance a debugging log message to better identify a mutex. (check-in: e60cb6d885 user: dan tags: debug)
14:23
Use __sync_synchronous(), when available, instead of a mutex when a memory barrier is needed. (check-in: 7d4562e9d5 user: drh tags: debug)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/mutex_unix.c.
251
252
253
254
255
256
257





258
259
260
261
262
263
264
265
266
#if SQLITE_MUTEX_NREF
  assert( p->nRef>0 || p->owner==0 );
  p->owner = pthread_self();
  p->nRef++;
#endif
  iTimer = sqlite3Hwtime() - iTimer;
  if( iTimer>100000 ){





    sqlite3_log(SQLITE_NOTICE, "slow mutex: %lld cycles on %d/%p",
                iTimer, MUTEX_ID(p), p);
  }
#endif

#ifdef SQLITE_DEBUG
  if( p->trace ){
    printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
  }







>
>
>
>
>

|







251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#if SQLITE_MUTEX_NREF
  assert( p->nRef>0 || p->owner==0 );
  p->owner = pthread_self();
  p->nRef++;
#endif
  iTimer = sqlite3Hwtime() - iTimer;
  if( iTimer>100000 ){
    sqlite3_mutex *pMaster = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER);
    int id = -1;
    if( p>=pMaster && p<=&pMaster[SQLITE_MUTEX_STATIC_APP3-2] ){
      id = (int)(p - pMaster) + 2;
    }
    sqlite3_log(SQLITE_NOTICE, "slow mutex: %lld cycles on %d/%p",
                iTimer, id, p);
  }
#endif

#ifdef SQLITE_DEBUG
  if( p->trace ){
    printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
  }