[parsec-users] PARSEC Pin instrumentation Error

Sudhanshu Shukla sudhan345 at gmail.com
Sun Apr 24 23:51:58 EDT 2011


Hi All,

I have been trying for instrument PARSEC with pin. For initial testing I am
using a pintool similar to malloc_mt which just records the thread begin and
thread end. The code for the pintool is attached with this mail.

On instrumenting raytrace and freqmine application(with 8, 16, 32 threads)
with this pintool. I observe that the number of threads created are not
equal to the number of threads that end.

For all the other application and kernels, the number of threads created is
same as number of threads that end.

Can somebody please verify this? or is there some problem with my pintool.

Thanks

Sudhanshu Shukla


-------------------------------------------------------Pintool
used---------------------------------
#include <stdio.h>
#include "pin.H"

KNOB<string> KnobOutputFile(KNOB_MODE_WRITEONCE, "pintool",
    "o", "traceThread.out", "specify output file name");

FILE * out;
PIN_LOCK lock;

VOID ThreadStart(THREADID threadid, CONTEXT *ctxt, INT32 flags, VOID *v)
{
    GetLock(&lock, threadid+1);
    fprintf(out, "thread begin %d\n",threadid);
    fflush(out);
    ReleaseLock(&lock);
}

VOID ThreadFini(THREADID threadid, const CONTEXT *ctxt, INT32 code, VOID *v)
{
    GetLock(&lock, threadid+1);
    fprintf(out, "thread end %d code %d\n",threadid, code);
    fflush(out);
    ReleaseLock(&lock);
}

VOID Fini(INT32 code, VOID *v)
{
    fclose(out);
}

INT32 Usage()
{
    PIN_ERROR("This Pintool prints a trace of thread start and thread end in
the guest application\n"
              + KNOB_BASE::StringKnobSummary() + "\n");
    return -1;
}

int main(INT32 argc, CHAR **argv)
{
    // Initialize the pin lock
    InitLock(&lock);

    // Initialize pin
    if (PIN_Init(argc, argv)) return Usage();
    PIN_InitSymbols();

    out = fopen(KnobOutputFile.Value().c_str(), "w");

    // Register Analysis routines to be called when a thread begins/ends
    PIN_AddThreadStartFunction(ThreadStart, 0);
    PIN_AddThreadFiniFunction(ThreadFini, 0);

    // Register Fini to be called when the application exits
    PIN_AddFiniFunction(Fini, 0);

    // Never returns
    PIN_StartProgram();

    return 0;
}


---------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/parsec-users/attachments/20110425/1ab790af/attachment.htm>


More information about the parsec-users mailing list