当前位置: 首页>>代码示例>>C++>>正文


C++ Tracer类代码示例

本文整理汇总了C++中Tracer的典型用法代码示例。如果您正苦于以下问题:C++ Tracer类的具体用法?C++ Tracer怎么用?C++ Tracer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Tracer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _getInstance

////////////////////////////////////////////////////////////////////////////////
// Set the trace facility to be used
////////////////////////////////////////////////////////////////////////////////
Uint32 Tracer::setTraceFacility(const String& traceFacility)
{
    Uint32 retCode = 0;
    Tracer* instance = _getInstance();

    if (traceFacility.size() != 0)
    {
        Uint32 index = 0;
        while (TRACE_FACILITY_LIST[index] != 0 )
        {
            if (String::equalNoCase( traceFacility,TRACE_FACILITY_LIST[index]))
            {
                if (index != instance->_traceFacility)
                {
                    instance->_setTraceHandler(index);
                }
                retCode = 1;
                break;
            }
            index++;
        }
    }

    return retCode;
}
开发者ID:govindraopanduru,项目名称:neopegasus,代码行数:28,代码来源:Tracer.cpp

示例2: Tracer

void 
Controller::render(){
	Tracer* trace = new Tracer(root);
	trace->setDimensions(500,500);
	trace->InitRender();
	trace->Render();
}
开发者ID:talech,项目名称:460,代码行数:7,代码来源:Controller.cpp

示例3: new

	Ref<Object> Tracer::dump(Frame * frame)
	{
		Tracer * tracer = NULL;
		
		frame->extract()(tracer, "self");
		
		StringStreamT buffer;
		tracer->dump(frame, buffer);
		
		return new(frame) String(buffer.str());
	}
开发者ID:ioquatix,项目名称:kai,代码行数:11,代码来源:Frame.cpp

示例4: closer

void closer (t_Tracer_OpenTr *open)
{
    Debugger                *c;
    PROCESS_INFORMATION     ProcInfo;
    char                    bla[30];
    
    if (open->Definition->Name == "CreateProcessA")
    {
        printf("MAIN: Process created (CreateProcessA)\n");

        if (!ReadProcessMemory(dbg.getProcessHandle(),
                               (LPCVOID)(open->OutArgs[9].data.address),
                               &ProcInfo,
                               sizeof(ProcInfo),
                               NULL))
        {
            printf("Failed to read process memory at %08X\n", open->OutArgs[9].data.address);
        }
        else
        {
            c = new (Debugger);

            sprintf(bla,"Child %u",ProcInfo.dwProcessId);
            c->attach(ProcInfo.dwProcessId);
            c->log.Name= bla;

            Children.push_back(c);
        }
    }
    else if (open->Definition->Name == "CreateProcessAsUserA")
    {
        printf("MAIN: Process created (CreateProcessAsUserA)\n");

        if (!ReadProcessMemory(dbg.getProcessHandle(),
                               (LPCVOID)(open->OutArgs[10].data.address),
                               &ProcInfo,
                               sizeof(ProcInfo),
                               NULL))
        {
            printf("Failed to read process memory at %08X\n", open->OutArgs[10].data.address);
        }
        else
        {
            c = new (Debugger);

            sprintf(bla,"Child %u",ProcInfo.dwProcessId);
            c->attach(ProcInfo.dwProcessId);
            c->log.Name= bla;

            Children.push_back(c);
        }
    } 
}
开发者ID:melbcat,项目名称:idc_public_script,代码行数:53,代码来源:main.cpp

示例5: setTraceLevel

void Tracer::setTraceLevel(TraceLevel tracelevel, bool recursive)
{
    m_tracelevel = tracelevel;

    if (recursive) {
        // set the tracelevl of all children recursively
        Tracer* child;
        for (child = m_children->first(); child; child = m_children->next()) {
            child->setTraceLevel(tracelevel, true);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:kphotobook-svn,代码行数:12,代码来源:tracer.cpp

示例6: TEST

TEST(HooksTest, UnknownChildHook)
{
    pid_t child_pid = fork();
    if (child_pid == 0) {
        _exit(0);
    }

    ASSERT_GE(child_pid, 0);

    std::optional<pid_t> exited_pid;
    std::optional<pid_t> unknown_pid;

    Tracer tracer;

    // Tracee must remain alive long enough for child_pid to exit
    auto tracee = tracer.fork([] { while (true) pause(); });
    ASSERT_TRUE(tracee);

    auto tracee_tid = tracee.value()->tid;

    Hooks hooks;

    hooks.syscall_entry = [&](auto t, auto &info) {
        if (unknown_pid) {
            SysCall sc("exit_group", info.syscall.abi());
            assert(sc);
            (void) t->modify_syscall_args(sc.num(), {});
        }
        return action::Default{};
    };

    hooks.tracee_exit = [&](auto pid, auto) {
        exited_pid = pid;
        return action::Default{};
    };

    hooks.unknown_child = [&](auto pid, auto) {
        unknown_pid = pid;

        // tracee must be a valid pointer because this hook would not have been
        // called if the only tracee exited or died
        (void) tracee.value()->interrupt();
    };

    ASSERT_TRUE(tracer.execute(hooks));

    ASSERT_EQ(exited_pid, tracee_tid);
    ASSERT_EQ(unknown_pid, child_pid);
}
开发者ID:chenxiaolong,项目名称:DualBootPatcher,代码行数:49,代码来源:test_hooks.cpp

示例7: free

void operator delete[](void* p)  
{  
        if (Tracer::Ready)  
                gNewTracer.Remove(p);  
        cout << "delete[](void* p)"<<endl;  
        free(p);  
}  
开发者ID:Mosquitooo,项目名称:MemManager,代码行数:7,代码来源:Module.cpp

示例8: malloc

void* operator new[] (size_t size)  
{  
        void* p = malloc(size);  
        if (Tracer::Ready)  
                gNewTracer.Add(p, "?", 0);  
        return p;  
}  
开发者ID:Mosquitooo,项目名称:MemManager,代码行数:7,代码来源:Module.cpp

示例9: kdbgstream

void Tracer::dump(QString indention) const
{
    // print some useful infos about this tracer
    kdbgstream(indention, 0, 999, true)
            << "- "
            << *m_tracerpartname
            << " [" << TRACE_LEVEL_NAME[m_tracelevel] << "] "
            << "(classname: " << *m_classname << "), "
            << "fulltracername: " << *m_tracername
            << endl;

    // call dump on each child
    indention.append("  ");
    Tracer* child;
    for (child = m_children->first(); child; child = m_children->next()) {
        child->dump(indention);
    }
}
开发者ID:BackupTheBerlios,项目名称:kphotobook-svn,代码行数:18,代码来源:tracer.cpp

示例10: main

int main(int argn, char* argv[])
{
	po::variables_map vm = parse_program_options(argn, argv);

	if(vm.empty() || vm.count("help"))
	{
		return 0;
	}

	pid_t child_pid = fork();

	if(child_pid == 0)
	{
		// Make args string vector into null-terminated char* array
		std::vector<std::string> args_vec = vm["commands"].as<std::vector<std::string>>();
		std::vector<char*> args;

		for(auto& arg : args_vec)
		{
			args.push_back(const_cast<char*>(arg.c_str()));
		}

		args.push_back(nullptr);

		// Run given process
		if(!run_child(args_vec.front(), args.data()))
		{
			std::cerr << "Error : Failed to execute and trace the given commands." << std::endl;
		}
	}
	else if(child_pid == -1)
	{
		std::cerr << "Error : Failed to execute the given commands." << std::endl;
	}
	else
	{
		Tracer tracer;
		tracer.do_trace(child_pid, vm);
	}

	return 0;
}
开发者ID:meungochoo,项目名称:2015_fall_computer_security,代码行数:42,代码来源:mytrace.cpp

示例11: main

int main()
{
  Signal<Vector,int> sig1( "sig1" );
  Vector v1(2); v1.fill(1.1); sig1 = v1;

  Signal<Vector,int> sig2( "sig2" );
  Vector v2(4); v2.fill(2.); sig2 = v2;

  Signal<Vector,int> sig3( "sig3" );
  Vector v3(6); v3.fill(3.); sig3 = v3;

  SignalTimeDependent<double,int> sigM( f,sotNOSIGNAL,"sigM" );
  sigM.access(0);
  
  Tracer* tracer = new Tracer( "trace" );
  tracer->addSignalToTrace( sig1 );
  tracer->openFiles( "/tmp/sot-core","tr_",".dat" );
  
  tracer->addSignalToTrace( sig2 );

  return 0;
}
开发者ID:olivier-stasse,项目名称:sot-core,代码行数:22,代码来源:test_traces.cpp

示例12: main

int main(int argc, char* argv[])
{
    if (argc < 3) {
        std::cerr << "Usage: "<<argv[0]<<" <host> <port>"<< endl;
        return 1;
    }
    serverIp = argv[1];
    serverPort = argv[2];

    try {
        io_service io_service;

        PutTraceReq putReq;
        Tracer* tracerPtr = putReq.mutable_tracer();
        tracerPtr->set_uid("190836141");
        tracerPtr->set_id("1778");
        tracerPtr->set_type("device_log");
        tracerPtr->set_time(time(0));
        tracerPtr->set_src("internal");
        tracerPtr->set_key("online_status");
        tracerPtr->set_value("this is the value");
        tracerPtr->set_status("0");

        eachPut(io_service, putReq);

        GetTraceReq getReq;
        getReq.set_uid("190836141");
        eachGet(io_service, getReq);

        io_service.run();
    }
    catch (std::exception& e) {
        std::cerr << "Exception: " << e.what() << "\n";
    }

    return 0;
}
开发者ID:foobarhe,项目名称:cpp-code,代码行数:37,代码来源:testClient.cpp

示例13: trace

bool Client::IsVisible (const Vector &pos) const
{
   Tracer trace (GetHeadOrigin (), pos, NO_BOTH, m_ent);

   return ! (trace.Fire () != 1.0);
}
开发者ID:xurubin,项目名称:yapb,代码行数:6,代码来源:engine.cpp

示例14: strTracername

//
// public static methods
//
Tracer* Tracer::getInstance(const char* tracername, const char* classname)
{
    QString strTracername(tracername);
    QString strClassname(classname);

    // if neither tracername nor classname is specified we return the root-tracer
    if (strTracername.isEmpty() && strClassname.isEmpty()) {
        return getRootTracer();
    }

    Tracer* currentTracer = getRootTracer();
    QString currentTracerName = QString("");
    
    // split the tracername into its parts
    QStringList parts = QStringList::split(TRACER_NAME_SEPARATOR, strTracername, false);

    // if specified the classname is handled as last part of the tracername
    if (!strClassname.isEmpty()) {
        parts.append(strClassname);
    }

    int partsCount = parts.count();

    // loop over the tracename parts and
    // try to get the tracer matching the tracername and classname
    // as soon as we don't find a matching subtracer we begin to create new tracers...
    for (int i = 0; i < partsCount; i++) {
        QString part = parts[i];
        
        // create the tracername of the tracer we would like at this point
        if (i > 0) {
            currentTracerName = currentTracerName.append(TRACER_NAME_SEPARATOR);
        }
        currentTracerName = currentTracerName.append(part);

        // try to get a matching tracer for the currentTracerName
        Tracer* matchingChild = currentTracer->getChild(part);
        if (matchingChild) {
            currentTracer = matchingChild;
        } else {
            //no matching subtracer found --> create one!

            Tracer* child;
            if (i + 1 == partsCount) {
                // this is the last tracer to instantiate --> create WITH classname
                child = new Tracer(currentTracerName, part, strClassname);
            } else {
                // this is a missing supertracer of the tracer to create --> create without classname
                child = new Tracer(currentTracerName, part, "");
            }

            // link the new tracer into the tracer tree
            currentTracer->m_children->append(child);
            child->m_parent = currentTracer;

            // tracers inherit the tracelevel of the parent
            child->m_tracelevel = currentTracer->m_tracelevel;
            
            currentTracer = child;
        }
    }

    // if a classname is specified but the resulting tracer has no one set
    // the tracer was already instantiated without a classname set
    // this most likely occurs when the tracer was configured by a traceconfigfile
    // --> force the classname
    if (!strClassname.isEmpty() && currentTracer->m_classname->isEmpty()) {
        currentTracer->m_classname = new QString(strClassname);
    }
    

    return currentTracer;
}
开发者ID:BackupTheBerlios,项目名称:kphotobook-svn,代码行数:76,代码来源:tracer.cpp

示例15: gl_loop


//.........这里部分代码省略.........
	}
	fb_copy_time = framebuffer.get_copy_exec_time();
	double total_msec = rt_time.msec_since_snap();

	if (min_time < 0)
		min_time = total_msec;
	else
		min_time = std::min(min_time,total_msec);

	if (max_time < 0)
		max_time = total_msec;
	else
		max_time = std::max(max_time,total_msec);

        if (device.release_graphic_resource(tex_id) ||
            cubemap.release_graphic_resources()) {
                std::cerr << "Error releasing texture resource." << std::endl;
                exit(1);
        }

        for (size_t i = 0; i < scenes.size(); ++i) {
                if (scenes[i].release_graphic_resources()) {
                        std::cerr << "Error releasing texture resource." << std::endl;
                        exit(1);
                }
        }

        ////////////////// Immediate mode textured quad
	glBindTexture(GL_TEXTURE_2D, gl_tex);

	glBegin(GL_TRIANGLE_STRIP);

	glTexCoord2f(1.0,1.0);
	glVertex2f(1.0,1.0);

	glTexCoord2f(1.0,0.0);
	glVertex2f(1.0,-1.0);

	glTexCoord2f(0.0,1.0);
	glVertex2f(-1.0,1.0);

	glTexCoord2f(0.0,0.0);
	glVertex2f(-1.0,-1.0);

	glEnd();
	////////////////////////////////////////////

	i += dir;
	if (!(i % (STEPS-1))){
		dir *= -1;
	}		
	std::cout << "Time elapsed: " 
		  << total_msec << " milliseconds " 
		  << "\t" 
		  << (1000.f / total_msec)
		  << " FPS"
		  << "\t"
		  << total_ray_count
		  << " rays casted "
		  << "\t(" << pixel_count << " primary, " 
		  << total_ray_count-pixel_count << " secondary)"
		  << "               \r" ;
	std::flush(std::cout);
	rt_time.snap_time();
	total_ray_count = 0;

	std::cout << "\nPrim Gen time: \t" << prim_gen_time  << std::endl;
	std::cout << "Sec Gen time: \t" << sec_gen_time << std::endl;
	std::cout << "Tracer time: \t" << prim_trace_time + sec_trace_time  
		  << " (" <<  prim_trace_time << " - " << sec_trace_time 
		  << ")" << std::endl;
	std::cout << "Shadow time: \t" << prim_shadow_trace_time + sec_shadow_trace_time 
		  << " (" <<  prim_shadow_trace_time 
		  << " - " << sec_shadow_trace_time << ")" << std::endl;
	std::cout << "Shader time: \t " << shader_time << std::endl;
	std::cout << "Fb clear time: \t" << fb_clear_time << std::endl;
	std::cout << "Fb copy time: \t" << fb_copy_time << std::endl;
	std::cout << std::endl;

	glutSwapBuffers();
	current_frame = (current_frame+motion_rate)%frames;
	if (current_frame == 0) {
		double t = seq_time.msec_since_snap();
		     
		std::cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" << std::endl;
		std::cout << "Sequence stats:" << std::endl << std::endl;
		std::cout << "Frames: " << frames << std::endl;
		std::cout << "Sequence render time: " << t << "msec\t(" 
			  << frames*1000.f/t << " FPS)" <<   std::endl;
		std::cout << "Mean / Min / Max render time: " 
			  <<  t/frames << " / " 
			  <<  min_time << " / " 
			  <<  max_time << " msec" << std::endl;
		std::cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" << std::endl;
		max_time = -1;
		min_time = -1;
		seq_time.snap_time();
	}

}
开发者ID:lscandolo,项目名称:Tesina-RT,代码行数:101,代码来源:rt-seq.cpp


注:本文中的Tracer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。