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


C++ process::clear_running方法代码示例

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


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

示例1: getAndShow

void getAndShow(process &currProcess) {
    procinfo pinfo;
    switch(get_proc_info(&pinfo, currProcess.get_pid()))
    {
	case -3: //error condition
	    //TODO error handling
#ifdef DEBUG
	    print_string("Not all pinfo values filled");
#endif
	    break;
	case -2: //error condition
#ifdef DEBUG
	    print_string("Extraneous values, some not read");
#endif
	    break;
	case -1: //error condition
	    currProcess.clear_keepLogging();
	    print_string("Error while opening stat file");
	    break;
	case 0: //do nothing
	    break;
	default:
	    currProcess.clear_keepLogging();
	    print_string("Unkown exit condition");
	    break;
    }

    currProcess.set_pinfo(pinfo);

    if(currProcess.get_fname() == "") //use the pid
    {
#ifdef DEBUG
	print_string("Using PID");
#endif
	if(currProcess.get_pname() == "") //set the pname for the log file.
	{
#ifdef DEBUG
	    print_string("Setting pname");
#endif
	    currProcess.set_pname(pinfo.values[cpu_comm]);
	    if(currProcess.get_terminalOutput()) //show pname if not set and outputting to terminal
	    {
		print_string(std::to_string(currProcess.get_pid()) + " pname is: " + currProcess.get_pname());
	    }
	}
	if(!currProcess.get_terminalOutput()) //don't care about the log file if not logging....
	{
#ifdef DEBUG
	    print_string("Setting logname");
#endif
	    currProcess.set_fname(currProcess.get_pname()+ "." + pinfo.values[cpu_pid] + ".log");
	}
    }

    //only show logname once, and only if outputting to a log
    if(currProcess.get_showOnce() && !currProcess.get_terminalOutput())
    {
#ifdef DEBUG
	print_string("Show Once, not terminalOutput");
#endif
	print_string("Log File: " + currProcess.get_fpath() + currProcess.get_fname());
    }

    if(pinfo.values[cpu_state] == "D") //D for DEAD
    {
#ifdef DEBUG
	print_string("DEAD");
#endif
	/* No idea what pid will be if  it comes back! Execution will never
	 * stop if search is set and it never comes back. pname should be set
	 * by now.
	 * Will continue to search, by pname only.
	 */
	currProcess.set_pid(0);
	currProcess.clear_running();
	if(!currProcess.get_search()) {
	    currProcess.clear_keepLogging();
	}
    }
    currProcess.clear_showOnce();

    currProcess.outputData();
}
开发者ID:android-device,项目名称:processanalyzer,代码行数:83,代码来源:kpi.cpp


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