コード例 #1
0
ファイル: VRPyListMath.cpp プロジェクト: AntonChalakov/polyvr
void VRPyListMath::init(PyObject* mod) {
    PyMethodDef testDef = {"add", (PyCFunction)VRPyListMath::add, METH_VARARGS, "test add fkt"};
    appendMethod(testDef);


    PyTypeObject* typeRef = &PyList_Type;
    string name = "list";
    if ( PyType_Ready(typeRef) < 0 ) { cout << "\nERROR! could not register " << name << endl; return; }
    PyModule_AddObject(mod, name.c_str(), (PyObject*)typeRef);
}
コード例 #2
0
ファイル: agent.cpp プロジェクト: intel4004/bergamot
void recordStackDump(jvmtiEnv* jvmti) {

    //long long before = getNanoTime();
    
    jvmtiStackInfo* stackInfo;
    jint threadCount;
    jvmtiError err;

    err = jvmti->GetAllStackTraces(MAX_FRAMES, &stackInfo, &threadCount);
    if (err != JVMTI_ERROR_NONE) {
        ERROR("GetAllStackTraces failed with %d", err);
        return;
    }
    
    for (int ti = 0; ti < threadCount; ++ti) {
        jvmtiStackInfo* infop = &stackInfo[ti];
        jthread thread = infop->thread;
        jvmtiFrameInfo* frames = infop->frame_buffer;

        jvmtiThreadInfo thread_info;
        err = jvmti->GetThreadInfo(thread, &thread_info);
        if(err != JVMTI_ERROR_NONE) {
           ERROR("GetMethodName failed with %d", err);
           return;
        }

        if(infop->frame_count > 0) {
            appendIndex(method_count);
            for (int fi = 0; fi < infop->frame_count; fi++) {
                appendMethod(frames[fi].method);
            }
        }
    }
    
    err = jvmti->Deallocate((unsigned char*) stackInfo);    
    
    //long long after =  getNanoTime();
    //total += after-before;
    //count++;
    //fprintf (stderr, "time = %lldns (%lldns avg)\n", after-before, total / count);
}