Return TypeFunction nameArguments
voidReportMutexContention(hzChain&,bool,)

Declared in file: hzProcess.h
Defined in file : hzLock.cpp

Function Logic:

0:START 1:hzXDate::SysDateTime 2:bHtml 3:hzChain::Printf items 4:hzChain::Printf hzChain::Printf s_allMtx pMtx 5:pMtx; 6:fWait fInuse 7:fInuse 8:ratio 9:ratio 10:sprintf nLockOpsW nLockOpsR nUnlocks nSpinsTotal nTriesTotal nWaitTotal nInuse FormalNumber vals FormalNumber vals FormalNumber vals FormalNumber vals FormalNumber vals FormalNumber vals FormalNumber vals 11:bHtml 12:items hzChain::Printf hzChain::Printf hzChain::Printf hzChain::Printf hzChain::Printf hzChain::Printf hzChain::Printf hzChain::Printf hzChain::Printf hzChain::Printf hzChain::Printf items 13:hzChain::Printf 14:bHtml 15:items 16: No text

Function body:

void ReportMutexContention (hzChain& Z, bool bHtml)
{
   _hzfunc(__func__) ;
   static  hzString    S = "Untitled" ;
   hzXDate     now ;
   hzLockRWD*  pMtx ;
   double      fWait ;
   double      fInuse ;
   double      ratio ;
   hzString    vals[9];
   uint64_t    nWaitTotal ;
   uint64_t    nInuse ;
   uint64_t    nSpinsTotal ;
   uint32_t    nTriesTotal ;
   uint32_t    nLockOpsW ;
   uint32_t    nLockOpsR ;
   uint32_t    nUnlocks ;
   char        buf[24];
   now.SysDateTime() ;
   if (bHtml)
   {
       Z.Printf("<p><center>Mutex Contention Report at %s</center></p>\n", *now) ;
       Z <<
       "<div align="right">\n<table width="90%" align="center" border="1" cellspacing="0" cellpadding="0" style="text-decoration:none; font-family:verdana; font-size:11px; font-weight:normal; color:#000000;">\n\t<tr>\n\t\t<th>Mutex ID</th>\n\t\t<th>Wr Locks</th>\n\t\t<th>Rd Locks</th>\n\t\t<th>Unlocks</th>\n\t\t<th>Status</th>\n\t\t<th>Spins</th>\n\t\t<th>Tries</th>\n\t\t<th>Wait/Overhead</th>\n\t\t<th>Lock Duration</th>\n\t\t<th>Ratio</th>\n\t\t<th>Name</th>\n\t</tr>\n"
                   ;
   }
   else
   {
       Z.Printf("Mutex Contention Report at %s\n", *now) ;
       Z.Printf("Mutex ID  Wr Locks  Rd Locks  Unlocks  Status   Spins     Tries  Wait/Overhead  Lock Duration  Ratio    Name\n") ;
   }
   for (pMtx = s_allMtx ; pMtx ; pMtx = pMtx->next)
   {
       fWait = pMtx->m_WaitTotal ;
       fInuse = pMtx->m_Inuse ;
       if (fInuse)
           ratio = fInuse/(fWait + fInuse) ;
       else
           ratio = 0.0;
       sprintf(buf, "%f", ratio) ;
       nLockOpsW = pMtx->m_LockOpsW ;
       nLockOpsR = pMtx->m_LockOpsR ;
       nUnlocks = pMtx->m_Unlocks ;
       nSpinsTotal = pMtx->m_SpinsTotal ;
       nTriesTotal = pMtx->m_TriesTotal ;
       nWaitTotal = pMtx->m_WaitTotal ;
       nInuse = pMtx->m_Inuse ;
       vals[0]= FormalNumber(nLockOpsW, 12);
       vals[1]= FormalNumber(nLockOpsR, 12);
       vals[2]= FormalNumber(nUnlocks, 12);
       vals[3]= FormalNumber(nSpinsTotal, 15);
       vals[4]= FormalNumber(nTriesTotal, 15);
       vals[5]= FormalNumber(nWaitTotal, 15);
       vals[6]= FormalNumber(nInuse, 15);
       if (bHtml)
       {
           Z << "\t<tr align="right">\n"   ;
           Z.Printf("<td>%03d</td>", pMtx->m_Id) ;
           Z.Printf("<td>%s</td>", *vals[0]);
           Z.Printf("<td>%s</td>", *vals[1]);
           Z.Printf("<td>%s</td>", *vals[2]);
           Z.Printf("<td>%11u</td>", pMtx->m_lockval) ;
           Z.Printf("<td>%s</td>", *vals[3]);
           Z.Printf("<td>%s</td>", *vals[4]);
           Z.Printf("<td>%s</td>", *vals[5]);
           Z.Printf("<td>%s</td>", *vals[6]);
           Z.Printf("<td>%s</td>", buf) ;
           Z.Printf("<td align="left">%s</td>"  , *S) ;
           Z << "\t</tr>\n" ;
       }
       else
       {
           Z.Printf("%03d  %s  %s  %s  %llu  %s  %s  %s  %s  %s  %s\n",
               pMtx->m_Id, *vals[0],*vals[1],*vals[2],pMtx->m_lockval, *vals[3],*vals[4],*vals[5],*vals[6],buf, *S) ;
       }
   }
   if (bHtml)
       Z << "</table>\n" ;
}