• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ print_cpu函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: debug_ask

bool debug_ask(Machine *pmach){
	char input[NMAX];
	while(1){
		printf("DEBUG? ");
		gets(input);
		if(strcmp(input,"h")==0){
			printf("h\thelp\n");
			printf("c\tcontinue(exit interactive debug mode)\n");
			printf("s\tstep by step(next instruction)\n");
			printf("RET\tstep by step(next instruction)\n");
			printf("r\tprint registers\n");
			printf("d\tprint data memory\n");
			printf("t\tprint text(program) memory\n");
			printf("p\tprint text(program) memory\n");
			printf("m\tprint registers and data memory\n");	
		}
		if(strcmp(input,"c")==0)
			return false;
		if(strcmp(input,"r")==0)
			print_cpu(pmach);
		if(strcmp(input,"RET")==0 || strcmp(input,"s")==0 || strcmp(input,"\0")==0)
			return true;
		if(strcmp(input,"d")==0)
			print_data(pmach);
		if(strcmp(input,"t")==0)
			print_program(pmach);
		if(strcmp(input,"p")==0)
			print_program(pmach);
		if(strcmp(input,"m")==0){
			print_cpu(pmach);
			print_data(pmach);
		}
	}
		return true;
}
开发者ID:superCarton,项目名称:projetFinSI3,代码行数:35,代码来源:debug.c


示例2: cpu_print_filter

void cpu_print_filter(pid_t pid) {
	EUID_ASSERT();
	
	// if the pid is that of a firejail  process, use the pid of the first child process
	EUID_ROOT();	// grsecurity
	char *comm = pid_proc_comm(pid);
	EUID_USER();	// grsecurity
	if (comm) {
		if (strcmp(comm, "firejail") == 0) {
			pid_t child;
			if (find_child(pid, &child) == 0) {
				pid = child;
			}
		}
		free(comm);
	}

	// check privileges for non-root users
	uid_t uid = getuid();
	if (uid != 0) {
		uid_t sandbox_uid = pid_get_uid(pid);
		if (uid != sandbox_uid) {
			fprintf(stderr, "Error: permission denied.\n");
			exit(1);
		}
	}

	print_cpu(pid);
	exit(0);
}
开发者ID:reinerh,项目名称:firejail,代码行数:30,代码来源:cpu.c


示例3: sched_debug_show

static int sched_debug_show(struct seq_file *m, void *v)
{
	u64 now = ktime_to_ns(ktime_get());
	int cpu;

	SEQ_printf(m, "Sched Debug Version: v0.09, %s %.*s\n",
		init_utsname()->release,
		(int)strcspn(init_utsname()->version, " "),
		init_utsname()->version);

	SEQ_printf(m, "now at %Lu.%06ld msecs\n", SPLIT_NS(now));

#define P(x) \
	SEQ_printf(m, "  .%-40s: %Ld\n", #x, (long long)(x))
#define PN(x) \
	SEQ_printf(m, "  .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
	P(jiffies);
	PN(sysctl_sched_latency);
	PN(sysctl_sched_min_granularity);
	PN(sysctl_sched_wakeup_granularity);
	PN(sysctl_sched_child_runs_first);
	P(sysctl_sched_features);
#undef PN
#undef P

	for_each_online_cpu(cpu)
		print_cpu(m, cpu);

	SEQ_printf(m, "\n");

	return 0;
}
开发者ID:Tof37,项目名称:msm7x27-2.6.32.x-nAa,代码行数:32,代码来源:sched_debug.c


示例4: main

int main(int argc, char** argv)
{
    printf(PIPEMENU_BEGIN);
    print_cpu(0, count_cpus());
    printf(PIPEMENU_END);
    return 0;
}
开发者ID:poomon,项目名称:obcpufreq,代码行数:7,代码来源:obcpufreq.c


示例5: sched_debug_show

static int sched_debug_show(struct seq_file *m, void *v)
{
	u64 ktime, sched_clk, cpu_clk;
	unsigned long flags;
	int cpu;

	local_irq_save(flags);
	ktime = ktime_to_ns(ktime_get());
	sched_clk = sched_clock();
	cpu_clk = local_clock();
	local_irq_restore(flags);

	SEQ_printf(m, "Sched Debug Version: v0.10, %s %.*s\n",
		init_utsname()->release,
		(int)strcspn(init_utsname()->version, " "),
		init_utsname()->version);

#define P(x) \
	SEQ_printf(m, "%-40s: %Ld\n", #x, (long long)(x))
#define PN(x) \
	SEQ_printf(m, "%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
	PN(ktime);
	PN(sched_clk);
	PN(cpu_clk);
	P(jiffies);
#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
	P(sched_clock_stable);
#endif
#undef PN
#undef P

	SEQ_printf(m, "\n");
	SEQ_printf(m, "sysctl_sched\n");

#define P(x) \
	SEQ_printf(m, "  .%-40s: %Ld\n", #x, (long long)(x))
#define PN(x) \
	SEQ_printf(m, "  .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
	PN(sysctl_sched_latency);
	PN(sysctl_sched_min_granularity);
	PN(sysctl_sched_wakeup_granularity);
	P(sysctl_sched_child_runs_first);
	P(sysctl_sched_features);
#undef PN
#undef P

	SEQ_printf(m, "  .%-40s: %d (%s)\n", "sysctl_sched_tunable_scaling",
		sysctl_sched_tunable_scaling,
		sched_tunable_scaling_names[sysctl_sched_tunable_scaling]);

	read_lock_irqsave(&tasklist_lock, flags);
	//for_each_online_cpu(cpu)
	for_each_possible_cpu(cpu)
		print_cpu(m, cpu);
	read_unlock_irqrestore(&tasklist_lock, flags);
	SEQ_printf(m, "\n");

	return 0;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:59,代码来源:debug.c


示例6: sysrq_sched_debug_show

void sysrq_sched_debug_show(void)
{
	int cpu;

	sched_debug_header(NULL);
	for_each_online_cpu(cpu)
		print_cpu(NULL, cpu);

}
开发者ID:RobinSystems,项目名称:linux-3.13,代码行数:9,代码来源:debug.c


示例7: registers_cmd

int registers_cmd(struct _6510_cpu* cpu, char memory[][9], char* string){
  char regname[5] = "1234";
  char buffer_reg[8+1] = "00000000";
  int key, content=-1;
  int i;
  // mon> mem af 02 ; mam[af] <- 02
  sscanf(string, " %*s %s %2x ", &(regname[0]), &content);

  key = -1;
  for(i=0;names[i]!=NULL;i++){
	if(strcmp(regname,names[i])==0){
	  key=i;
	  break;
	}
  }
  if(content!=-1){
	int2register(content, buffer_reg);
	switch(key)
	  {
	  case ACC:
		cp_register(buffer_reg, cpu->rega);
		break;
	  case ABRL:
		cp_register(buffer_reg, cpu->abrl);
		break;
	  case ABRH:
		cp_register(buffer_reg, cpu->abrh);
		break;
	  case DBR:
		cp_register(buffer_reg, cpu->dbr);
		break;
	  case IDX:
		cp_register(buffer_reg, cpu->regx);
		break;
	  case IDY:
		cp_register(buffer_reg, cpu->regy);
		break;
	  case PCL:
		cp_register(buffer_reg, cpu->pcl);
		break;
	  case PCH:
		cp_register(buffer_reg, cpu->pch);
		break;
	  case IR:
		cp_register(buffer_reg, cpu->ir);
		break;
	  case SP:
		cp_register(buffer_reg, cpu->sp);
		break;
	  default:
		break;
	  }
  }
  print_cpu(cpu);
  return 1;
}
开发者ID:monkeyinabox,项目名称:cpu,代码行数:56,代码来源:parser.c


示例8: debug_ask

/*!
 * Cette fonction gère le dialogue pour l'option \c -d (debug). Dans ce mode,
 * elle est invoquée après l'exécution de chaque instruction.  Elle affiche le
 * menu de mise au point et on exécute le choix de l'utilisateur. Si cette
 * fonction retourne faux, on abandonne le mode de mise au point interactive
 * pour les instructions suivantes et jusqu'à la fin du programme.
 * 
 * \param mach la machine/programme en cours de simulation
 * \return vrai si l'on doit continuer en mode debug, faux sinon
 */
bool debug_ask(Machine *pmach){
	printf("DEBUG? ");
	char commande = '\n';
	bool premier = true;
	char rep;
	while( (rep=getchar()) != '\n' && rep != EOF){
		if(premier) commande = rep;
		premier = false;
	};
	switch(commande){
	  case 'h':
		printf("Available commands :\n\th\thelp\n\tc\tcontinue (exit interactive debug mode)\n\ts\tstep by step (next instruction)\n\tRET\tstep by step (next instruction)\n\tr\tprint registers\n\td\tprint data memory\n\tt\tprint text (program) memory\n\tp\tprint text (program) memory\n\tm\tprint registers and data memory\n");
          break;
	  case 'c':
		return false;
	  break;
          case 's':
		return true;
          break;
	  case 'r':
		print_cpu(pmach);
          break;
          case 'd':
		print_data(pmach);
          break;
          case 't':
		print_program(pmach);
          break;
	  case 'p':
		print_program(pmach);
          break;
	  case 'm':
		print_cpu(pmach);
		print_data(pmach);
          break;
	  case '\n':
		return true;
	  break;
	  default:
          break;
	}
	return debug_ask(pmach);
}
开发者ID:Buisson,项目名称:ProjetC,代码行数:53,代码来源:debug.c


示例9: sched_debug_show

static int sched_debug_show(struct seq_file *m, void *v)
{
	int cpu = (unsigned long)(v - 2);

	if (cpu != -1)
		print_cpu(m, cpu);
	else
		sched_debug_header(m);

	return 0;
}
开发者ID:RobinSystems,项目名称:linux-3.13,代码行数:11,代码来源:debug.c


示例10: main

int main(void) {
    FILE *fp_mail;
    char *status = (char *)alloca(200);
    int b, d, m;
    b = BATTERY_INTERVAL;
    d = DATE_INTERVAL;
    m = MAIL_INTERVAL;

    struct timespec interval = {
        .tv_sec  = UPDATE_INTERVAL,
        .tv_nsec = 0 };
    int sockfd = socket(AF_INET, SOCK_DGRAM, 0);

    for ( ; ; nanosleep(&interval, NULL)) {
        if (++b > BATTERY_INTERVAL) {
            print_battery();
            b = 0; }
        if (++d > DATE_INTERVAL) {
            print_time();
            d = 0; }
        if (++m > MAIL_INTERVAL) {
            if (print_mail(fp_mail) == 0) {
                m = 0; }
            if (errno == EBADF) {
                fp_mail = mail_init(); } }
        if (sockfd != -1) {
            print_iw(sockfd); }
        strncpy(_root, print_free("/"), _FREE_LEN);
        strncpy(_home, print_free("/home"), _FREE_LEN);
        print_time();
        print_cpu();
        print_memory();
        snprintf(status, 200, "%s %s | %s | %s | %s | %s | %s | %s"
                            , _root, _home, _iw, _battery, _mail, _cpu
                            , _mem, _date);
        printf("%s\n", status);

        }//break; }

    pclose(fp_mail);
    cleanup(sockfd); }

double get_battery_stats(const char *path) {
    FILE *stats;
    double value = 0;

    if ((stats = fopen(path, "r"))== NULL) {
        return -1; }
    fscanf(stats, "%lf", &value);
    fclose(stats);

    return value; }
开发者ID:Theta91,项目名称:dotfiles,代码行数:52,代码来源:status.c


示例11: while

void *load_check(void *param)
{	
	//int n=(int)param;
	cpu_t cpu1, cpu2;
    	while(1) 
	{
    		cpu_t *p_cpu1 = cpu_check(&cpu1);
        	sleep(1);
        	cpu_t *p_cpu2 = cpu_check(&cpu2);
        	print_cpu(p_cpu1, p_cpu2);
    	}
	pthread_exit(0);
}
开发者ID:hubaditya,项目名称:projects,代码行数:13,代码来源:Monitoring_System_final.c


示例12: print_versions

void Summary::print()
{
    print_versions();
    print_memory();
    print_cpu();
    print_threads();
    print_pools();

#   ifndef XMRIG_NO_API
    print_api();
#   endif

    print_commands();
}
开发者ID:0xjohndoe,项目名称:xmrig,代码行数:14,代码来源:Summary.cpp


示例13: timer_list_show

static int timer_list_show(struct seq_file *m, void *v)
{
	struct timer_list_iter *iter = v;

	if (iter->cpu == -1 && !iter->second_pass)
		timer_list_header(m, iter->now);
	else if (!iter->second_pass)
		print_cpu(m, iter->cpu, iter->now);
#ifdef CONFIG_GENERIC_CLOCKEVENTS
	else if (iter->cpu == -1 && iter->second_pass)
		timer_list_show_tickdevices_header(m);
	else
		print_tickdevice(m, tick_get_device(iter->cpu), iter->cpu);
#endif
	return 0;
}
开发者ID:ahmadrezamontazerolghaem,项目名称:VLB-CAC,代码行数:16,代码来源:timer_list.c


示例14: cpu

void cpu(pid_t pid) {
	if (getuid() == 0)
		firemon_drop_privs();
	
	pid_read(pid);
	
	// print processes
	int i;
	for (i = 0; i < max_pids; i++) {
		if (pids[i].level == 1) {
			pid_print_list(i, 0);
			int child = find_child(i);
			if (child != -1)
				print_cpu(child);
		}
	}
}
开发者ID:mahdi1234,项目名称:firejail,代码行数:17,代码来源:cpu.c


示例15: print_hub

int		print_hub(t_taupe *taupe)
{
  wclear(taupe->top->win);
  print_sys(taupe->sys, taupe->top);
  print_task(taupe->task, taupe->top);
  print_cpu(taupe->cpu, taupe->top);
  print_mem(taupe->mem, taupe->top);
  if (taupe->signal->on)
    {
      print_opt(taupe->signal, "Send Signal");
      print_signal(taupe->signal, taupe->pid);
    }
  else if (taupe->sort->on)
    print_opt(taupe->sort, "Sort By");
  print_main(taupe);
  return (0);
}
开发者ID:kiuKisas,项目名称:Taupe,代码行数:17,代码来源:print.c


示例16: sysrq_timer_list_show

void sysrq_timer_list_show(void)
{
	u64 now = ktime_to_ns(ktime_get());
	int cpu;

	timer_list_header(NULL, now);

	for_each_online_cpu(cpu)
		print_cpu(NULL, cpu, now);

#ifdef CONFIG_GENERIC_CLOCKEVENTS
	timer_list_show_tickdevices_header(NULL);
	for_each_online_cpu(cpu)
		print_tickdevice(NULL, tick_get_device(cpu), cpu);
#endif
	return;
}
开发者ID:ahmadrezamontazerolghaem,项目名称:VLB-CAC,代码行数:17,代码来源:timer_list.c


示例17: cpu

void cpu(void) {
	if (getuid() == 0)
		firemon_drop_privs();
	
	pid_read(0);	// include all processes
	
	// print processes
	int i;
	for (i = 0; i < MAX_PIDS; i++) {
		if (pids[i].level == 1) {
			pid_print_list(i, 0);
			int child = find_child(i);
			if (child != -1)
				print_cpu(child);
		}
	}
}
开发者ID:shifter,项目名称:firejail,代码行数:17,代码来源:cpu.c


示例18: timer_list_show

static int timer_list_show(struct seq_file *m, void *v)
{
	u64 now = ktime_to_ns(ktime_get());
	int cpu;

	SEQ_printf(m, "Timer List Version: v0.6\n");
	SEQ_printf(m, "HRTIMER_MAX_CLOCK_BASES: %d\n", HRTIMER_MAX_CLOCK_BASES);
	SEQ_printf(m, "now at %Ld nsecs\n", (unsigned long long)now);

	for_each_online_cpu(cpu)
		print_cpu(m, cpu, now);

	SEQ_printf(m, "\n");
	timer_list_show_tickdevices(m);

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:gemini-board,代码行数:17,代码来源:timer_list.c


示例19: root_cpuinfo

PUBLIC void root_cpuinfo(void)
{
	struct cpu_info cpu_info[CONFIG_MAX_CPUS];
	struct machine machine;
	unsigned c;

	if (sys_getmachine(&machine)) {
		printf("PROCFS: cannot get machine\n");
		return;
	}
	if (sys_getcpuinfo(&cpu_info)) {
		printf("PROCFS: cannot get cpu info\n");
		return;
	}

	for (c = 0; c < machine.processors_count; c++)
		print_cpu(&cpu_info[c], c);
}
开发者ID:DragonQuan,项目名称:minix3,代码行数:18,代码来源:cpuinfo.c


示例20: main

/*!
 * Options de la ligne de commande :
 *
 * <dl>
 *   <dt>-d</dt><dd>mode pas à pas (mise au point)</dd>
 *
 *   <dt>-f</dt><dd>le programme est dans un fichier binaire ; le nom de ce
 *   fichier doit être fourni également en paramètre de la ligne de
 *   commande ; sans cette option, on exécute un programme de test prédéfini.</dd>
 *
 * </dl>
 */
int main(int argc, char *argv[])
{
    bool debug = false;
    bool binfile = false;
    bool no_exec = false;
    char *programfile = NULL;

    if (argc > 1) 
    {
        for (int iarg = 1; iarg < argc; ++iarg)
        {
            if (argv[iarg][0] == '-')
                switch (argv[iarg][1])
                {
                case 'd':
                    debug = true;
                    break;
                case 'b': 
                    binfile = true;
                    break;
                 case 'l': 
                    no_exec = true;
                    break;
                  case 'h':
                    usage();
                    exit(EXIT_SUCCESS);
                default:
                    fprintf(stderr, "Unknown option: %s\n", argv[iarg]);
                    usage();
                    exit(EXIT_FAILURE);
                }
            else if (binfile)
                programfile = argv[iarg];
            else 
                fprintf(stderr, "Trailing options ignored...\n");
        }
    }

    Machine mach;

    if (!binfile) 
        load_program(&mach, textsize, text, datasize, data, dataend);
    else 
        read_program(&mach, programfile);   

    printf("\n*** Sauvegarde des programmes et données initiales en format binaire ***\n\n");
    dump_memory(&mach);

    printf("\n*** Machine state before execution ***\n");
    print_program(&mach);
    print_data(&mach);
    print_cpu(&mach);

    if (no_exec) 
        return 0;

    printf("\n*** Execution trace ***\n\n");
    simul(&mach, debug);

    printf("\n*** Machine state after execution ***\n");
    print_cpu(&mach);
    print_data(&mach);
    if(allocated){
		free(mach._text);
		free(mach._data);
	}

    return 0; 
}
开发者ID:etiennestrobbe,项目名称:Pinoccio,代码行数:81,代码来源:test_simul.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ print_curr_locks函数代码示例发布时间:2022-05-30
下一篇:
C++ print_buffer函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap