trackEvent(ticks2msec(aReader, aEvent->u.alloc.interval), eventType, callsite, aEvent->u.alloc.ptr, aEvent->u.alloc.size, oldcallsite, oldptr, oldsize);
trackEvent(ticks2msec(aReader, aEvent->u.alloc.interval), eventType, ticks2usec(aReader, aEvent->u.alloc.cost), callsite, aEvent->u.alloc.ptr, aEvent->u.alloc.size, oldcallsite, oldptr, oldsize);
void tmEventHandler(tmreader* aReader, tmevent* aEvent){    if(NULL != aReader && NULL != aEvent)    {        switch(aEvent->type)        {            /*            ** Events we ignore.            */            case TM_EVENT_LIBRARY:            case TM_EVENT_METHOD:            case TM_EVENT_STATS:            case TM_EVENT_TIMESTAMP:                break;            /*            ** Allocation events need to be tracked.            */            case TM_EVENT_MALLOC:            case TM_EVENT_CALLOC:            case TM_EVENT_REALLOC:            case TM_EVENT_FREE:            {                PRUint32 oldptr = 0;                PRUint32 oldsize = 0;                tmcallsite* callsite = NULL;                tmcallsite* oldcallsite = NULL;                if(TM_EVENT_REALLOC == aEvent->type)                {                    /*                    ** Only care about old arguments if there were any.                    */                    if(0 != aEvent->u.alloc.oldserial)                    {                        oldptr = aEvent->u.alloc.oldptr;                        oldsize = aEvent->u.alloc.oldsize;                        oldcallsite = tmreader_callsite(aReader, aEvent->u.alloc.oldserial);                        if(NULL == oldcallsite)                        {                            REPORT_ERROR(__LINE__, tmreader_callsite);                        }                    }                }                callsite = tmreader_callsite(aReader, aEvent->serial);                if(NULL != callsite)                {                    /*                    ** Verify a callsite run is there.                    ** If not, we are ignoring this callsite.                    */                    if(NULL != CALLSITE_RUN(callsite))                    {                        char eventType = aEvent->type;                                                /*                        ** Play a nasty trick on reallocs of size zero.                        ** They are to become free events.                        ** This allows me to avoid all types of special case code.                        */                        if(0 == aEvent->u.alloc.size && TM_EVENT_REALLOC == aEvent->type)                        {                            eventType = TM_EVENT_FREE;                        }                        trackEvent(ticks2msec(aReader, aEvent->u.alloc.interval), eventType, callsite, aEvent->u.alloc.ptr, aEvent->u.alloc.size, oldcallsite, oldptr, oldsize);                    }                }                else                {                    REPORT_ERROR(__LINE__, tmreader_callsite);                }            }            break;            /*            ** Callsite, set up the callsite run if it does not exist.            */            case TM_EVENT_CALLSITE:            {                tmcallsite* callsite = tmreader_callsite(aReader, aEvent->serial);                if(NULL != callsite)                {                    if(NULL == CALLSITE_RUN(callsite))                    {                        int createrun = __LINE__;#if defined(MOZILLA_CLIENT)                        /*                        ** For a mozilla spacetrace, ignore this particular                        **  callsite as it is just noise, and causes us to                        **  use a lot of memory.                        **                        ** This callsite is present on the linux build,                        **  not sure if the other platforms have it.                        */                        if(0 != hasCallsiteMatch(callsite, "g_main_is_running", ST_FOLLOW_PARENTS))                        {                            createrun = 0;                        }#endif /* MOZILLA_CLIENT */                        if(0 != createrun)                        {                            callsite->data = createRun(0);                        }                    }                }                else                {                    REPORT_ERROR(__LINE__, tmreader_callsite);                }            }            break;            /*            ** Unhandled events should not be allowed.            */            default:            {                REPORT_ERROR(__LINE__, tmEventHandler);            }            break;        }    }}