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

C++ print_report函数代码示例

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

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



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

示例1: eval_calls

void eval_calls(std::vector<strvcfentry> entries, std::vector<strsimul> simul, int max_allowed_dist, std::string output) {

	strreport notfound = init_report();
	strreport additional = init_report();
	strreport found = init_report();

	FILE * right;
	FILE * addition;

	std::string out = output;
	out += "_right.vcf";
	right = fopen(out.c_str(), "w");

	out = output;
	out += "addition.vcf";
	addition = fopen(out.c_str(), "w");

	//for (size_t i = 0; i < entries.size(); i++) {
	//	std::cout<<entries[i].start.chr<<" "<<entries[i].start.pos<<" "<<entries[i].stop.chr<<" "<<entries[i].stop.pos<<" "<<entries[i].type<<std::endl;
	//}

	// std::cout<<"type dv"<<" "<<"rv"<<" "<<"dr"<<" "<<"rr"<<" "<<"gq"<<std::endl;
	for (size_t i = 0; i < entries.size(); i++) {
		bool found = false;
		for (size_t j = 0; j < simul.size(); j++) {
			if (simul[j].type == entries[i].type) {
				if (match_coords(simul[j], entries[i], max_allowed_dist)) { //check if order is perserved!
					simul[j].identified = true;
					found = true;
				}
			}
		}
		if (!found) {
			fprintf(addition, "%s", entries[i].header.c_str());
			for (std::map<std::string, std::string>::iterator tz = entries[i].calls.begin(); tz != entries[i].calls.end(); tz++) {
				fprintf(addition, "%s", (*tz).second.c_str());
			}
			fprintf(addition, "%c", '\n');
			add_to_report(additional, entries[i].type);
			//	std::cout<<"additional found: "<<entries[i].type<<" "<<entries[i].start.chr<<" "<<entries[i].start.pos<<" "<<entries[i].stop.chr<<" "<<entries[i].stop.pos<<std::endl;
		} else {
			fprintf(right, "%s", entries[i].header.c_str());
			for (std::map<std::string, std::string>::iterator tz = entries[i].calls.begin(); tz != entries[i].calls.end(); tz++) {
				fprintf(right, "%s", (*tz).second.c_str());
			}
			fprintf(right, "%c", '\n');
		}
	}

	for (size_t j = 0; j < simul.size(); j++) {
		if (!simul[j].identified) {
			add_to_report(notfound, simul[j].type);
			std::cout<<simul[j].type<<" "<<simul[j].start.chr<<" "<<simul[j].start.pos<<" END: "<<simul[j].stop.chr<<" "<<simul[j].stop.pos<<std::endl;
		} else {
			add_to_report(found, simul[j].type);
		}
	}
	std::cout << " Overall: " << simul.size() << " " << print_report(found) << " " << print_report(notfound) << " " << print_report(additional) << " " << get_TP(simul.size(), found) << " " << get_FP(found, additional) << std::endl;
}
开发者ID:fritzsedlazeck,项目名称:SURVIVOR,代码行数:59,代码来源:Eval_vcf.cpp


示例2: tls_endpoint_estab_handler

static void tls_endpoint_estab_handler(const char *cipher, void *arg)
{
	int err;
	(void)arg;

	re_fprintf(stderr, "\r[ %u .. %c ]",
		   tlsperf.count,
		   0x20 + tlsperf.count % 0x60);

	if (tls_endpoint_established(tlsperf.ep_cli) &&
	    tls_endpoint_established(tlsperf.ep_srv)) {

		if (tlsperf.count >= tlsperf.num) {

			tlsperf.ts_estab = tmr_jiffies();

			re_printf("\nDONE!\n");
			re_printf("cipher:        %s\n", cipher);
			print_report();

			re_cancel();
		}
		else {
			stop_test();
			err = start_test();
			if (err)
				abort_test(err);
		}
	}
}
开发者ID:jamella,项目名称:tlsperf,代码行数:30,代码来源:main.c


示例3: aio_write_done

static void aio_write_done(void *opaque, int ret)
{
    struct aio_ctx *ctx = opaque;
    struct timeval t2;

    gettimeofday(&t2, NULL);


    if (ret < 0) {
        printf("aio_write failed: %s\n", strerror(-ret));
        goto out;
    }

    if (ctx->qflag) {
        goto out;
    }

    /* Finally, report back -- -C gives a parsable format */
    t2 = tsub(t2, ctx->t1);
    print_report("wrote", &t2, ctx->offset, ctx->qiov.size,
                 ctx->qiov.size, 1, ctx->Cflag);
out:
    qemu_io_free(ctx->buf);
    qemu_iovec_destroy(&ctx->qiov);
    g_free(ctx);
}
开发者ID:AjayMashi,项目名称:x-tier,代码行数:26,代码来源:qemu-io.c


示例4: aio_write_done

static void
aio_write_done(void *opaque, int ret)
{
	struct aio_ctx *ctx = opaque;
	struct timeval t2;

	gettimeofday(&t2, NULL);


	if (ret < 0) {
		printf("aio_write failed: %s\n", strerror(-ret));
		goto out;
	}

	if (ctx->qflag) {
		goto out;
	}

	
	t2 = tsub(t2, ctx->t1);
	print_report("wrote", &t2, ctx->offset, ctx->qiov.size,
		     ctx->qiov.size, 1, ctx->Cflag);
out:
	qemu_io_free(ctx->buf);
	free(ctx);
}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:26,代码来源:qemu-io.c


示例5: send_probes

int send_probes (int ttl) 
{
  /* Removed to compile cleanly with -Wall */
  //int i;
  int probe, code, done;

  Setsockopt (sendfd, IPPROTO_IP, IP_TTL, &ttl, sizeof(int));
  bzero (salast, salen);

  printf ("%2d  ", ttl);
  fflush (stdout);

  done = 0; /* count the number of probes that generate an ICMP_DEST_UNREACH */

  for (probe = 0; probe < nprobes; probe++) {
    send_dgram (ttl);
    code = recv_dgram ();

    if (code == -3) {
      printf (" *");
    } else {
      print_report ();
    }

    if (code == -1) done++;
    fflush (stdout);
  }
  printf ("ms\n");
  return done;
}
开发者ID:ElizabethDuncan,项目名称:SoftwareSystemsClass,代码行数:30,代码来源:trout.c


示例6: main

int main (void){
    
    
    // Checks users input and exectutes task based on selection
    int choice = 0;
    
    // As long as user hasnt quit
    while (choice != QUIT)
    {
        // Prints menu, prompts user for selection
        choice = get_menu_choice();
        
        if (choice == 1)
            printf("\nBeeping the computer \a\a\a");
        else{
            if (choice == 2)
                print_report();
        }
    }
    printf("You chose to quit!\n");
    
    return 0;
    
    
}
开发者ID:tracymcaruso,项目名称:Learning-C,代码行数:25,代码来源:7.1.c


示例7: mono_portability_iomap_event

static void mono_portability_iomap_event (MonoProfiler *prof, const char *report, const char *pathname, const char *new_pathname)
{
	guint32 hash, pathnameHash;
	MismatchedFilesStats *stats;

	if (!runtime_initialized)
		return;

	mono_os_mutex_lock (&mismatched_files_section);
	hash = calc_strings_hash (pathname, new_pathname, &pathnameHash);
	stats = (MismatchedFilesStats*)g_hash_table_lookup (prof->mismatched_files_hash, &hash);
	if (stats == NULL) {
		guint32 *hashptr;

		stats = (MismatchedFilesStats*) g_malloc (sizeof (MismatchedFilesStats));
		stats->count = 1;
		stats->requestedName = g_strdup (pathname);
		stats->actualName = g_strdup (new_pathname);
		hashptr = (guint32*)g_malloc (sizeof (guint32));
		if (hashptr) {
			*hashptr = hash;
			g_hash_table_insert (prof->mismatched_files_hash, (gpointer)hashptr, stats);
		} else
			g_error ("Out of memory allocating integer pointer for mismatched files hash table.");

		store_string_location (prof, (const gchar*)stats->requestedName, pathnameHash, strlen (stats->requestedName));
		mono_os_mutex_unlock (&mismatched_files_section);

		print_report ("%s -     Found file path: '%s'\n", report, new_pathname);
	} else {
		mono_os_mutex_unlock (&mismatched_files_section);
		stats->count++;
	}
}
开发者ID:Appercode,项目名称:mono,代码行数:34,代码来源:mono-profiler-iomap.c


示例8: preserve_rec

/*
 *	preserve_rec() - writes record into the pacct0 file.
 */
static int
preserve_rec(struct acctjob *jh, int type, char *name)
{
	/*
	 *	Read the next record.
	 */
	if (readacctent(sfd, &acctent, FORWARD) <= 0) {
		acct_err(ACCT_ABORT,
		       _("An error occurred during the reading of file '%s' %s."),
			spacct, name);
	}

	if (acctent.csa && (acctent.csa->ac_jid == 0) ) {
		return(-1);
	}

	if (db_flag > 1) {
		Ndebug("preserve_rec(4): %s record, offset(%d, %#o), type %d:",
			name, rcd_offset, rcd_offset, type);
		Dump_acct_hdr(acctent.prime);
	}

	if (do_report) {
		print_report(type, &acctent);
		do_report = 0;
		if (A_opt) {
			write_ok = query();
		}
	}

	if (write_ok) {
		if (first_rec) {
		/*
		 *	Create and write an uptime record if needed.
		 */
			if (jh->aj_btime > uptime_stop) {
				Uptime_record(TRUE);
			}

			if ((rcd_offset = seekacct(pfd0, 0, SEEK_CUR)) < 0) {
				acct_perr(ACCT_ABORT, errno,
					_("An error occurred during the positioning of file '%s' %s."),
					pacct0,
					"for the job entry");
			}
			first_rec = FALSE;
		}

		if (writeacctent(pfd0, &acctent) <= 0) {
			acct_perr(ACCT_ABORT, errno,
				_("An error occurred during the writing of file '%s'."),
				pacct0);
		}
	}

	return(0);
}
开发者ID:LinuxCSA,项目名称:CSA,代码行数:60,代码来源:csarecy.c


示例9: discard_f

static int discard_f(int argc, char **argv)
{
    struct timeval t1, t2;
    int Cflag = 0, qflag = 0;
    int c, ret;
    int64_t offset;
    int count;

    while ((c = getopt(argc, argv, "Cq")) != EOF) {
        switch (c) {
        case 'C':
            Cflag = 1;
            break;
        case 'q':
            qflag = 1;
            break;
        default:
            return command_usage(&discard_cmd);
        }
    }

    if (optind != argc - 2) {
        return command_usage(&discard_cmd);
    }

    offset = cvtnum(argv[optind]);
    if (offset < 0) {
        printf("non-numeric length argument -- %s\n", argv[optind]);
        return 0;
    }

    optind++;
    count = cvtnum(argv[optind]);
    if (count < 0) {
        printf("non-numeric length argument -- %s\n", argv[optind]);
        return 0;
    }

    gettimeofday(&t1, NULL);
    ret = bdrv_discard(bs, offset >> BDRV_SECTOR_BITS,
                       count >> BDRV_SECTOR_BITS);
    gettimeofday(&t2, NULL);

    if (ret < 0) {
        printf("discard failed: %s\n", strerror(-ret));
        goto out;
    }

    /* Finally, report back -- -C gives a parsable format */
    if (!qflag) {
        t2 = tsub(t2, t1);
        print_report("discard", &t2, offset, count, count, 1, Cflag);
    }

out:
    return 0;
}
开发者ID:AjayMashi,项目名称:x-tier,代码行数:57,代码来源:qemu-io.c


示例10: begin_report

void spawner_new_c::run() {
    begin_report();
    for (auto& i : runners) {
        i->run_process_async();
    }
    for (auto& i : runners) {
        i->wait_for();
    }
    print_report();
}
开发者ID:klenin,项目名称:Spawner,代码行数:10,代码来源:spawner_new.cpp


示例11: main

int main(int argc, char **argv) {
	int opt, sprofdiff = 0;

#ifdef DEBUG
	/* disable buffering so the output mixes correctly */
	setvbuf(stdout, NULL, _IONBF, 0);
	setvbuf(stderr, NULL, _IONBF, 0);
#endif

	/* parse arguments */
	while ((opt = getopt(argc, argv, "b:dp:s:")) != -1) {
		switch (opt) {
		case 'b':
			/* additional binary specified */
			binary_add(optarg);
			break;
		case 'd':
			/* generate output for sprofdiff */
			sprofdiff = 1;
			break;
		case 'p':
			/* minimum percentage specified */
			minimum_perc = atof(optarg);
			if (minimum_perc < 0 || minimum_perc > 100) {
				fprintf(stderr, "error: cut-off percentage "
					"makes no sense: %g\n", minimum_perc);
				exit(1);
			}
			break;
		case 's':
			/* source tree directory specified */
			src_path = optarg;
			break;
		default: usage(argv[0]);
		}
	}

	/* load samples */
	if (optind >= argc) usage(argv[0]);
	for (; optind < argc; optind++) {
		struct endpoint_info *e; 
		load_trace(argv[optind]);
		for(e = endpoints; e; e = e->next)
			e->seen = 0;
	}

	/* print report */
	if (sprofdiff) {
		print_diff();
	} else {
		print_report();
	}
	return 0;
}
开发者ID:josepedrazap,项目名称:trabajo2,代码行数:54,代码来源:sprofalyze.c


示例12: main

/*
 * Top Level Flow Control
 */
int
main(int argc, char **argv)
{
	grok_args(argc, argv);

	if (do_input()) {
		set_fuel_type();
		print_report();
		rocksim_report();
	}
	putchar('\n');
	save_text_dump(stdout);
	exit(0);
}
开发者ID:duke1swd,项目名称:HSIM,代码行数:17,代码来源:report.c


示例13: event_handler

static void event_handler(json_object *obj) {
  json_object *child, *data, *body, *event;
  char *ev, *type, *message;

  if (!json_object_object_get_ex(obj, "data", &data)) {
    Warning("data not found");
    return;
  }
  if (!json_object_object_get_ex(data, "event", &event)) {
    Warning("event not found");
    return;
  }
  if (!json_object_object_get_ex(data, "body", &body)) {
    Warning("body not found");
    return;
  }
  ev = (char *)json_object_get_string(event);
  if (!strcmp(ev, "client_data_ready")) {
    if (!json_object_object_get_ex(body, "type", &child)) {
      Warning("type not found");
      return;
    }
    type = (char *)json_object_get_string(child);
    if (type != NULL) {
      if (!strcmp("report", type)) {
        print_report(body);
      } else if (!strcmp("misc", type)) {
        download_file(body);
      }
    }
  } else if (!strcmp(ev, "announcement")) {
    if (!json_object_object_get_ex(body, "message", &child)) {
      Warning("message not found");
      return;
    }
    message = (char *)json_object_get_string(child);
    Notify(_("orca cloud announce"), message, "gtk-dialog-info", 30);
  } else if (!strcmp(ev, "websocket_reconnect")) {
    Notify(_("websocket_reconnect"), _("websocket_reconnect_message"),
           "gtk-dialog-warning", 30);
  } else if (!strcmp(ev, "websocket_disconnect")) {
    Notify(_("websocket_disconnect"), _("websocket_disconnect_message"),
           "gtk-dialog-warning", 30);
  } else {
    Warning("unknown event:%s", ev);
  }
}
开发者ID:montsuqi,项目名称:panda,代码行数:47,代码来源:push_action.c


示例14: m_message

exception::exception(std::string message, bool print)
  : m_message(message),
    m_stack_trace(stack_trace::get()) {

  // Construct default message if none is provided
  if (m_message.empty()) {
    std::stringstream ss("LBANN exception");
    const auto& rank = get_rank_in_world();
    if (rank >= 0) {
      ss << " on rank " << rank;
    }
    m_message = ss.str();
  }

  // Print report to standard error stream
  if (print) { print_report(std::cerr); }
  
}
开发者ID:LLNL,项目名称:lbann,代码行数:18,代码来源:exception.cpp


示例15: aio_read_done

static void
aio_read_done(void *opaque, int ret)
{
    struct aio_ctx *ctx = opaque;
    struct timeval t2;

    gettimeofday(&t2, NULL);

    if (ret < 0) {
        printf("readv failed: %s\n", strerror(-ret));
        goto out;
    }

    if (ctx->Pflag) {
        void *cmp_buf = malloc(ctx->qiov.size);

        memset(cmp_buf, ctx->pattern, ctx->qiov.size);
        if (memcmp(ctx->buf, cmp_buf, ctx->qiov.size)) {
            printf("Pattern verification failed at offset %"
                   PRId64 ", %zd bytes\n",
                   ctx->offset, ctx->qiov.size);
        }
        free(cmp_buf);
    }

    if (ctx->qflag) {
        goto out;
    }

    if (ctx->vflag) {
        dump_buffer(ctx->buf, ctx->offset, ctx->qiov.size);
    }

    /* Finally, report back -- -C gives a parsable format */
    t2 = tsub(t2, ctx->t1);
    print_report("read", &t2, ctx->offset, ctx->qiov.size,
                 ctx->qiov.size, 1, ctx->Cflag);
out:
    qemu_io_free(ctx->buf);
    free(ctx);
}
开发者ID:ChengyuSong,项目名称:ATrace,代码行数:41,代码来源:qemu-io.c


示例16: osm_dump_all

void osm_dump_all(osm_opensm_t * osm)
{
	if (OSM_LOG_IS_ACTIVE_V2(&osm->log, OSM_LOG_ROUTING)) {
		/* unicast routes */
		osm_dump_qmap_to_file(osm, "opensm-lid-matrix.dump",
				      &osm->subn.sw_guid_tbl, dump_lid_matrix,
				      osm);
		osm_dump_qmap_to_file(osm, "opensm-lfts.dump",
				      &osm->subn.sw_guid_tbl, dump_ucast_lfts,
				      osm);
		if (OSM_LOG_IS_ACTIVE_V2(&osm->log, OSM_LOG_DEBUG))
			dump_qmap(stdout, &osm->subn.sw_guid_tbl,
				  dump_ucast_path_distribution, osm);

		/* An attempt to get osm_switch_recommend_path to report the
		   same routes that a sweep would assign. */
		if (osm->subn.opt.scatter_ports)
			srandom(osm->subn.opt.scatter_ports);

		osm_dump_qmap_to_file(osm, "opensm.fdbs",
				      &osm->subn.sw_guid_tbl,
				      dump_ucast_routes, osm);
		/* multicast routes */
		osm_dump_qmap_to_file(osm, "opensm.mcfdbs",
				      &osm->subn.sw_guid_tbl,
				      dump_mcast_routes, osm);
		/* SL2VL tables */
		if (osm->subn.opt.qos ||
		    (osm->routing_engine_used &&
		     osm->routing_engine_used->update_sl2vl))
			osm_dump_qmap_to_file(osm, "opensm-sl2vl.dump",
					      &osm->subn.port_guid_tbl,
					      dump_sl2vl_tbl, osm);
	}
	osm_dump_qmap_to_file(osm, "opensm-subnet.lst",
			      &osm->subn.node_guid_tbl, dump_topology_node,
			      osm);
	if (OSM_LOG_IS_ACTIVE_V2(&osm->log, OSM_LOG_VERBOSE))
		print_report(osm, stdout);
}
开发者ID:chu11,项目名称:opensm-snapshot,代码行数:40,代码来源:osm_dump.c


示例17: write_f


//.........这里部分代码省略.........
        case 'p':
            pflag = 1;
            break;
        case 'P':
            Pflag = 1;
            pattern = parse_pattern(optarg);
            if (pattern < 0) {
                return 0;
            }
            break;
        case 'q':
            qflag = 1;
            break;
        case 'z':
            zflag = 1;
            break;
        default:
            return command_usage(&write_cmd);
        }
    }

    if (optind != argc - 2) {
        return command_usage(&write_cmd);
    }

    if (bflag + pflag + zflag > 1) {
        printf("-b, -p, or -z cannot be specified at the same time\n");
        return 0;
    }

    if (zflag && Pflag) {
        printf("-z and -P cannot be specified at the same time\n");
        return 0;
    }

    offset = cvtnum(argv[optind]);
    if (offset < 0) {
        printf("non-numeric length argument -- %s\n", argv[optind]);
        return 0;
    }

    optind++;
    count = cvtnum(argv[optind]);
    if (count < 0) {
        printf("non-numeric length argument -- %s\n", argv[optind]);
        return 0;
    }

    if (!pflag) {
        if (offset & 0x1ff) {
            printf("offset %" PRId64 " is not sector aligned\n",
                   offset);
            return 0;
        }

        if (count & 0x1ff) {
            printf("count %d is not sector aligned\n",
                   count);
            return 0;
        }
    }

    if (!zflag) {
        buf = qemu_io_alloc(count, pattern);
    }

    gettimeofday(&t1, NULL);
    if (pflag) {
        cnt = do_pwrite(buf, offset, count, &total);
    } else if (bflag) {
        cnt = do_save_vmstate(buf, offset, count, &total);
    } else if (zflag) {
        cnt = do_co_write_zeroes(offset, count, &total);
    } else if (cflag) {
        cnt = do_write_compressed(buf, offset, count, &total);
    } else {
        cnt = do_write(buf, offset, count, &total);
    }
    gettimeofday(&t2, NULL);

    if (cnt < 0) {
        printf("write failed: %s\n", strerror(-cnt));
        goto out;
    }

    if (qflag) {
        goto out;
    }

    /* Finally, report back -- -C gives a parsable format */
    t2 = tsub(t2, t1);
    print_report("wrote", &t2, offset, count, total, cnt, Cflag);

out:
    if (!zflag) {
        qemu_io_free(buf);
    }

    return 0;
}
开发者ID:AjayMashi,项目名称:x-tier,代码行数:101,代码来源:qemu-io.c


示例18: readv_f

static int readv_f(int argc, char **argv)
{
    struct timeval t1, t2;
    int Cflag = 0, qflag = 0, vflag = 0;
    int c, cnt;
    char *buf;
    int64_t offset;
    /* Some compilers get confused and warn if this is not initialized.  */
    int total = 0;
    int nr_iov;
    QEMUIOVector qiov;
    int pattern = 0;
    int Pflag = 0;

    while ((c = getopt(argc, argv, "CP:qv")) != EOF) {
        switch (c) {
        case 'C':
            Cflag = 1;
            break;
        case 'P':
            Pflag = 1;
            pattern = parse_pattern(optarg);
            if (pattern < 0) {
                return 0;
            }
            break;
        case 'q':
            qflag = 1;
            break;
        case 'v':
            vflag = 1;
            break;
        default:
            return command_usage(&readv_cmd);
        }
    }

    if (optind > argc - 2) {
        return command_usage(&readv_cmd);
    }


    offset = cvtnum(argv[optind]);
    if (offset < 0) {
        printf("non-numeric length argument -- %s\n", argv[optind]);
        return 0;
    }
    optind++;

    if (offset & 0x1ff) {
        printf("offset %" PRId64 " is not sector aligned\n",
               offset);
        return 0;
    }

    nr_iov = argc - optind;
    buf = create_iovec(&qiov, &argv[optind], nr_iov, 0xab);
    if (buf == NULL) {
        return 0;
    }

    gettimeofday(&t1, NULL);
    cnt = do_aio_readv(&qiov, offset, &total);
    gettimeofday(&t2, NULL);

    if (cnt < 0) {
        printf("readv failed: %s\n", strerror(-cnt));
        goto out;
    }

    if (Pflag) {
        void *cmp_buf = g_malloc(qiov.size);
        memset(cmp_buf, pattern, qiov.size);
        if (memcmp(buf, cmp_buf, qiov.size)) {
            printf("Pattern verification failed at offset %"
                   PRId64 ", %zd bytes\n", offset, qiov.size);
        }
        g_free(cmp_buf);
    }

    if (qflag) {
        goto out;
    }

    if (vflag) {
        dump_buffer(buf, offset, qiov.size);
    }

    /* Finally, report back -- -C gives a parsable format */
    t2 = tsub(t2, t1);
    print_report("read", &t2, offset, qiov.size, total, cnt, Cflag);

out:
    qemu_iovec_destroy(&qiov);
    qemu_io_free(buf);
    return 0;
}
开发者ID:AjayMashi,项目名称:x-tier,代码行数:97,代码来源:qemu-io.c


示例19: read_f


//.........这里部分代码省略.........
            vflag = 1;
            break;
        default:
            return command_usage(&read_cmd);
        }
    }

    if (optind != argc - 2) {
        return command_usage(&read_cmd);
    }

    if (bflag && pflag) {
        printf("-b and -p cannot be specified at the same time\n");
        return 0;
    }

    offset = cvtnum(argv[optind]);
    if (offset < 0) {
        printf("non-numeric length argument -- %s\n", argv[optind]);
        return 0;
    }

    optind++;
    count = cvtnum(argv[optind]);
    if (count < 0) {
        printf("non-numeric length argument -- %s\n", argv[optind]);
        return 0;
    }

    if (!Pflag && (lflag || sflag)) {
        return command_usage(&read_cmd);
    }

    if (!lflag) {
        pattern_count = count - pattern_offset;
    }

    if ((pattern_count < 0) || (pattern_count + pattern_offset > count))  {
        printf("pattern verification range exceeds end of read data\n");
        return 0;
    }

    if (!pflag) {
        if (offset & 0x1ff) {
            printf("offset %" PRId64 " is not sector aligned\n",
                   offset);
            return 0;
        }
        if (count & 0x1ff) {
            printf("count %d is not sector aligned\n",
                   count);
            return 0;
        }
    }

    buf = qemu_io_alloc(count, 0xab);

    gettimeofday(&t1, NULL);
    if (pflag) {
        cnt = do_pread(buf, offset, count, &total);
    } else if (bflag) {
        cnt = do_load_vmstate(buf, offset, count, &total);
    } else {
        cnt = do_read(buf, offset, count, &total);
    }
    gettimeofday(&t2, NULL);

    if (cnt < 0) {
        printf("read failed: %s\n", strerror(-cnt));
        goto out;
    }

    if (Pflag) {
        void *cmp_buf = g_malloc(pattern_count);
        memset(cmp_buf, pattern, pattern_count);
        if (memcmp(buf + pattern_offset, cmp_buf, pattern_count)) {
            printf("Pattern verification failed at offset %"
                   PRId64 ", %d bytes\n",
                   offset + pattern_offset, pattern_count);
        }
        g_free(cmp_buf);
    }

    if (qflag) {
        goto out;
    }

    if (vflag) {
        dump_buffer(buf, offset, count);
    }

    /* Finally, report back -- -C gives a parsable format */
    t2 = tsub(t2, t1);
    print_report("read", &t2, offset, count, total, cnt, Cflag);

out:
    qemu_io_free(buf);

    return 0;
}
开发者ID:AjayMashi,项目名称:x-tier,代码行数:101,代码来源:qemu-io.c


示例20: multiwrite_f


//.........这里部分代码省略.........

	while ((c = getopt(argc, argv, "CqP:")) != EOF) {
		switch (c) {
		case 'C':
			Cflag = 1;
			break;
		case 'q':
			qflag = 1;
			break;
		case 'P':
			pattern = parse_pattern(optarg);
			if (pattern < 0)
				return 0;
			break;
		default:
			return command_usage(&writev_cmd);
		}
	}

	if (optind > argc - 2)
		return command_usage(&writev_cmd);

	nr_reqs = 1;
	for (i = optind; i < argc; i++) {
		if (!strcmp(argv[i], ";")) {
			nr_reqs++;
		}
	}

	reqs = qemu_malloc(nr_reqs * sizeof(*reqs));
	buf = qemu_malloc(nr_reqs * sizeof(*buf));
	qiovs = qemu_malloc(nr_reqs * sizeof(*qiovs));

	for (i = 0; i < nr_reqs; i++) {
		int j;

		
		offset = cvtnum(argv[optind]);
		if (offset < 0) {
			printf("non-numeric offset argument -- %s\n", argv[optind]);
			return 0;
		}
		optind++;

		if (offset & 0x1ff) {
			printf("offset %lld is not sector aligned\n",
				(long long)offset);
			return 0;
		}

        if (i == 0) {
            first_offset = offset;
        }

		
		for (j = optind; j < argc; j++) {
			if (!strcmp(argv[j], ";")) {
				break;
			}
		}

		nr_iov = j - optind;

		
		reqs[i].qiov = &qiovs[i];
		buf[i] = create_iovec(reqs[i].qiov, &argv[optind], nr_iov, pattern);
		reqs[i].sector = offset >> 9;
		reqs[i].nb_sectors = reqs[i].qiov->size >> 9;

		optind = j + 1;

		offset += reqs[i].qiov->size;
		pattern++;
	}

	gettimeofday(&t1, NULL);
	cnt = do_aio_multiwrite(reqs, nr_reqs, &total);
	gettimeofday(&t2, NULL);

	if (cnt < 0) {
		printf("aio_multiwrite failed: %s\n", strerror(-cnt));
		goto out;
	}

	if (qflag)
		goto out;

	
	t2 = tsub(t2, t1);
	print_report("wrote", &t2, first_offset, total, total, cnt, Cflag);
out:
	for (i = 0; i < nr_reqs; i++) {
		qemu_io_free(buf[i]);
		qemu_iovec_destroy(&qiovs[i]);
	}
	qemu_free(buf);
	qemu_free(reqs);
	qemu_free(qiovs);
	return 0;
}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:101,代码来源:qemu-io.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ print_response函数代码示例发布时间:2022-05-30
下一篇:
C++ print_regs函数代码示例发布时间: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