зеркало из https://github.com/mozilla/pjs.git
Make generated graphs capable of handling multiple simultaneous access.
This commit is contained in:
Родитель
732ad9d7a8
Коммит
254b6893e5
|
@ -3615,6 +3615,7 @@ int graphFootprint(STRequest* inRequest, STRun* aRun)
|
|||
PRUint32 traverse = 0;
|
||||
PRUint32 timeval = 0;
|
||||
PRUint32 loop = 0;
|
||||
PRBool underLock = PR_FALSE;
|
||||
|
||||
/*
|
||||
** Decide if this is custom or we should use the cache.
|
||||
|
@ -3622,12 +3623,22 @@ int graphFootprint(STRequest* inRequest, STRun* aRun)
|
|||
if(aRun == inRequest->mContext->mSortedRun)
|
||||
{
|
||||
YData = inRequest->mContext->mFootprintYData;
|
||||
underLock = PR_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
YData = YDataArray;
|
||||
}
|
||||
|
||||
/*
|
||||
** Protect the shared data so that only one client has access to it
|
||||
** at any given time.
|
||||
*/
|
||||
if(PR_FALSE != underLock)
|
||||
{
|
||||
PR_Lock(inRequest->mContext->mImageLock);
|
||||
}
|
||||
|
||||
/*
|
||||
** Only do the computations if we aren't cached already.
|
||||
*/
|
||||
|
@ -3668,6 +3679,14 @@ int graphFootprint(STRequest* inRequest, STRun* aRun)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Done with the lock.
|
||||
*/
|
||||
if(PR_FALSE != underLock)
|
||||
{
|
||||
PR_Unlock(inRequest->mContext->mImageLock);
|
||||
}
|
||||
|
||||
if(0 == retval)
|
||||
{
|
||||
PRUint32 minMemory = (PRUint32)-1;
|
||||
|
@ -3809,6 +3828,7 @@ int graphTimeval(STRequest* inRequest, STRun* aRun)
|
|||
PRUint32 traverse = 0;
|
||||
PRUint32 timeval = globals.mMinTimeval;
|
||||
PRUint32 loop = 0;
|
||||
PRBool underLock = PR_FALSE;
|
||||
|
||||
/*
|
||||
** Decide if this is custom or we should use the global cache.
|
||||
|
@ -3816,12 +3836,22 @@ int graphTimeval(STRequest* inRequest, STRun* aRun)
|
|||
if(aRun == inRequest->mContext->mSortedRun)
|
||||
{
|
||||
YData = inRequest->mContext->mTimevalYData;
|
||||
underLock = PR_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
YData = YDataArray;
|
||||
}
|
||||
|
||||
/*
|
||||
** Protect the shared data so that only one client has access to it
|
||||
** at any given time.
|
||||
*/
|
||||
if(PR_FALSE != underLock)
|
||||
{
|
||||
PR_Lock(inRequest->mContext->mImageLock);
|
||||
}
|
||||
|
||||
/*
|
||||
** Only do the computations if we aren't cached already.
|
||||
*/
|
||||
|
@ -3866,6 +3896,14 @@ int graphTimeval(STRequest* inRequest, STRun* aRun)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Done with the lock.
|
||||
*/
|
||||
if(PR_FALSE != underLock)
|
||||
{
|
||||
PR_Unlock(inRequest->mContext->mImageLock);
|
||||
}
|
||||
|
||||
if(0 == retval)
|
||||
{
|
||||
PRUint32 minMemory = (PRUint32)-1;
|
||||
|
@ -4007,6 +4045,7 @@ int graphLifespan(STRequest* inRequest, STRun* aRun)
|
|||
PRUint32 traverse = 0;
|
||||
PRUint32 timeval = 0;
|
||||
PRUint32 loop = 0;
|
||||
PRBool underLock = PR_FALSE;
|
||||
|
||||
/*
|
||||
** Decide if this is custom or we should use the global cache.
|
||||
|
@ -4014,12 +4053,22 @@ int graphLifespan(STRequest* inRequest, STRun* aRun)
|
|||
if(aRun == inRequest->mContext->mSortedRun)
|
||||
{
|
||||
YData = inRequest->mContext->mLifespanYData;
|
||||
underLock = PR_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
YData = YDataArray;
|
||||
}
|
||||
|
||||
/*
|
||||
** Protect the shared data so that only one client has access to it
|
||||
** at any given time.
|
||||
*/
|
||||
if(PR_FALSE != underLock)
|
||||
{
|
||||
PR_Lock(inRequest->mContext->mImageLock);
|
||||
}
|
||||
|
||||
/*
|
||||
** Only do the computations if we aren't cached already.
|
||||
*/
|
||||
|
@ -4067,6 +4116,14 @@ int graphLifespan(STRequest* inRequest, STRun* aRun)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Done with the lock.
|
||||
*/
|
||||
if(PR_FALSE != underLock)
|
||||
{
|
||||
PR_Unlock(inRequest->mContext->mImageLock);
|
||||
}
|
||||
|
||||
if(0 == retval)
|
||||
{
|
||||
PRUint32 minMemory = (PRUint32)-1;
|
||||
|
@ -4208,6 +4265,7 @@ int graphWeight(STRequest* inRequest, STRun* aRun)
|
|||
PRUint32 traverse = 0;
|
||||
PRUint32 timeval = globals.mMinTimeval;
|
||||
PRUint32 loop = 0;
|
||||
PRBool underLock = PR_FALSE;
|
||||
|
||||
/*
|
||||
** Decide if this is custom or we should use the global cache.
|
||||
|
@ -4215,12 +4273,22 @@ int graphWeight(STRequest* inRequest, STRun* aRun)
|
|||
if(aRun == inRequest->mContext->mSortedRun)
|
||||
{
|
||||
YData64 = inRequest->mContext->mWeightYData64;
|
||||
underLock = PR_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
YData64 = YDataArray64;
|
||||
}
|
||||
|
||||
/*
|
||||
** Protect the shared data so that only one client has access to it
|
||||
** at any given time.
|
||||
*/
|
||||
if(PR_FALSE != underLock)
|
||||
{
|
||||
PR_Lock(inRequest->mContext->mImageLock);
|
||||
}
|
||||
|
||||
/*
|
||||
** Only do the computations if we aren't cached already.
|
||||
*/
|
||||
|
@ -4273,6 +4341,14 @@ int graphWeight(STRequest* inRequest, STRun* aRun)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Done with the lock.
|
||||
*/
|
||||
if(PR_FALSE != underLock)
|
||||
{
|
||||
PR_Unlock(inRequest->mContext->mImageLock);
|
||||
}
|
||||
|
||||
if(0 == retval)
|
||||
{
|
||||
PRUint64 minWeight64 = LL_INIT(0xFFFFFFFF, 0xFFFFFFFF);
|
||||
|
@ -5505,7 +5581,7 @@ void handleClient(void* inArg)
|
|||
** mime type, otherwise, say it is text/html.
|
||||
*/
|
||||
PR_fprintf(aFD, "HTTP/1.1 200 OK%s", crlf);
|
||||
PR_fprintf(aFD, "Server: %s%s", "$Id: spacetrace.c,v 1.36 2002-05-13 02:43:25 blythe%netscape.com Exp $", crlf);
|
||||
PR_fprintf(aFD, "Server: %s%s", "$Id: spacetrace.c,v 1.37 2002-05-13 03:02:52 blythe%netscape.com Exp $", crlf);
|
||||
PR_fprintf(aFD, "Content-type: ");
|
||||
if(NULL != strstr(start, ".png"))
|
||||
{
|
||||
|
@ -5931,6 +6007,13 @@ int initCaches(void)
|
|||
{
|
||||
break;
|
||||
}
|
||||
#if ST_WANT_GRAPHS
|
||||
inCache->mItems[loop].mContext.mImageLock = PR_NewLock();
|
||||
if(NULL == inCache->mItems[loop].mContext.mImageLock)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if(loop != inCache->mItemCount)
|
||||
|
@ -5991,6 +6074,13 @@ int destroyCaches(void)
|
|||
PR_DestroyRWLock(inCache->mItems[loop].mContext.mRWLock);
|
||||
inCache->mItems[loop].mContext.mRWLock = NULL;
|
||||
}
|
||||
#if ST_WANT_GRAPHS
|
||||
if(NULL != inCache->mItems[loop].mContext.mImageLock)
|
||||
{
|
||||
PR_DestroyLock(inCache->mItems[loop].mContext.mImageLock);
|
||||
inCache->mItems[loop].mContext.mImageLock = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
inCache->mItemCount = 0;
|
||||
|
|
|
@ -486,13 +486,19 @@ typedef struct __struct_STContext
|
|||
** This should not be modified after initialization.
|
||||
** mSortedRun A pre sorted run taken from the global run, with our
|
||||
** options applied.
|
||||
** mImageLock An overly simplistic locking mechanism to protect the
|
||||
** shared image cache.
|
||||
** The proper implementation would have a reader/writer
|
||||
** lock per cached image data.
|
||||
** However, this will prove to be simpler for the time
|
||||
** being.
|
||||
** mFootprintCached Wether or not YData contains something useful.
|
||||
** mFootprintYData Precomputed cached graph data.
|
||||
** mTimevalCached Wether or not YData contains something useful.
|
||||
** mTimevalYData Precomputed cached graph data.
|
||||
** mLifespanCached Wether or not YData contains something useful.
|
||||
** mLifespanYData Precomputed cached graph data.
|
||||
** mWeightCached Wether or not YData contains something useful.
|
||||
** mFootprintYData Precomputed cached graph data.
|
||||
** mTimevalYData Precomputed cached graph data.
|
||||
** mLifespanYData Precomputed cached graph data.
|
||||
** mWeightYData Precomputed cached graph data.
|
||||
*/
|
||||
{
|
||||
|
@ -500,13 +506,14 @@ typedef struct __struct_STContext
|
|||
PRUint32 mIndex;
|
||||
STRun* mSortedRun;
|
||||
#if ST_WANT_GRAPHS
|
||||
PRLock* mImageLock;
|
||||
PRBool mFootprintCached;
|
||||
PRUint32 mFootprintYData[STGD_SPACE_X];
|
||||
PRBool mTimevalCached;
|
||||
PRUint32 mTimevalYData[STGD_SPACE_X];
|
||||
PRBool mLifespanCached;
|
||||
PRUint32 mLifespanYData[STGD_SPACE_X];
|
||||
PRBool mWeightCached;
|
||||
PRUint32 mFootprintYData[STGD_SPACE_X];
|
||||
PRUint32 mTimevalYData[STGD_SPACE_X];
|
||||
PRUint32 mLifespanYData[STGD_SPACE_X];
|
||||
PRUint64 mWeightYData64[STGD_SPACE_X];
|
||||
#endif
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче