本文整理汇总了C++中FILE_INFO::write方法的典型用法代码示例。如果您正苦于以下问题:C++ FILE_INFO::write方法的具体用法?C++ FILE_INFO::write怎么用?C++ FILE_INFO::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FILE_INFO
的用法示例。
在下文中一共展示了FILE_INFO::write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_state
int CLIENT_STATE::write_state(MIOFILE& f) {
unsigned int i, j;
int retval;
#ifdef SIM
fprintf(stderr, "simulator shouldn't write state file\n");
exit(1);
#endif
f.printf("<client_state>\n");
retval = host_info.write(f, true, true);
if (retval) return retval;
retval = time_stats.write(f, false);
if (retval) return retval;
retval = net_stats.write(f);
if (retval) return retval;
for (j=0; j<projects.size(); j++) {
PROJECT* p = projects[j];
retval = p->write_state(f);
if (retval) return retval;
for (i=0; i<apps.size(); i++) {
if (apps[i]->project == p) {
retval = apps[i]->write(f);
if (retval) return retval;
}
}
for (i=0; i<file_infos.size(); i++) {
if (file_infos[i]->project != p) continue;
FILE_INFO* fip = file_infos[i];
// don't write file infos for anonymous platform app files
//
if (fip->anonymous_platform_file) continue;
retval = fip->write(f, false);
if (retval) return retval;
}
for (i=0; i<app_versions.size(); i++) {
if (app_versions[i]->project == p) {
app_versions[i]->write(f);
}
}
for (i=0; i<workunits.size(); i++) {
if (workunits[i]->project == p) workunits[i]->write(f);
}
for (i=0; i<results.size(); i++) {
if (results[i]->project == p) results[i]->write(f, false);
}
p->write_project_files(f);
#ifdef ENABLE_AUTO_UPDATE
if (auto_update.present && auto_update.project==p) {
auto_update.write(f);
}
#endif
}
active_tasks.write(f);
f.printf(
"<platform_name>%s</platform_name>\n"
"<core_client_major_version>%d</core_client_major_version>\n"
"<core_client_minor_version>%d</core_client_minor_version>\n"
"<core_client_release>%d</core_client_release>\n"
"<user_run_request>%d</user_run_request>\n"
"<user_run_prev_request>%d</user_run_prev_request>\n"
"<user_gpu_request>%d</user_gpu_request>\n"
"<user_gpu_prev_request>%d</user_gpu_prev_request>\n"
"<user_network_request>%d</user_network_request>\n"
"<new_version_check_time>%f</new_version_check_time>\n"
"<all_projects_list_check_time>%f</all_projects_list_check_time>\n",
get_primary_platform(),
core_client_version.major,
core_client_version.minor,
core_client_version.release,
cpu_run_mode.get_perm(),
cpu_run_mode.get_prev(),
gpu_run_mode.get_perm(),
gpu_run_mode.get_prev(),
network_run_mode.get_perm(),
new_version_check_time,
all_projects_list_check_time
);
if (strlen(language)) {
f.printf("<language>%s</language>\n", language);
}
if (newer_version.size()) {
f.printf("<newer_version>%s</newer_version>\n", newer_version.c_str());
}
for (i=1; i<platforms.size(); i++) {
f.printf("<alt_platform>%s</alt_platform>\n", platforms[i].name.c_str());
}
if (gui_proxy_info.present) {
gui_proxy_info.write(f);
}
if (strlen(main_host_venue)) {
f.printf("<host_venue>%s</host_venue>\n", main_host_venue);
}
f.printf("</client_state>\n");
return 0;
}
示例2: write
int RESULT::write(MIOFILE& out, bool to_server) {
unsigned int i;
FILE_INFO* fip;
int n, retval;
out.printf(
"<result>\n"
" <name>%s</name>\n"
" <final_cpu_time>%f</final_cpu_time>\n"
" <final_elapsed_time>%f</final_elapsed_time>\n"
" <exit_status>%d</exit_status>\n"
" <state>%d</state>\n"
" <platform>%s</platform>\n"
" <version_num>%d</version_num>\n",
name,
final_cpu_time,
final_elapsed_time,
exit_status,
state(),
platform,
version_num
);
if (strlen(plan_class)) {
out.printf(" <plan_class>%s</plan_class>\n", plan_class);
}
if (fpops_per_cpu_sec) {
out.printf(" <fpops_per_cpu_sec>%f</fpops_per_cpu_sec>\n", fpops_per_cpu_sec);
}
if (fpops_cumulative) {
out.printf(" <fpops_cumulative>%f</fpops_cumulative>\n", fpops_cumulative);
}
if (intops_per_cpu_sec) {
out.printf(" <intops_per_cpu_sec>%f</intops_per_cpu_sec>\n", intops_per_cpu_sec);
}
if (intops_cumulative) {
out.printf(" <intops_cumulative>%f</intops_cumulative>\n", intops_cumulative);
}
if (final_peak_working_set_size) {
out.printf(
" <final_peak_working_set_size>%.0f</final_peak_working_set_size>\n",
final_peak_working_set_size
);
}
if (final_peak_swap_size) {
out.printf(
" <final_peak_swap_size>%.0f</final_peak_swap_size>\n",
final_peak_swap_size
);
}
if (final_peak_disk_usage) {
out.printf(
" <final_peak_disk_usage>%.0f</final_peak_disk_usage>\n",
final_peak_disk_usage
);
}
if (final_bytes_sent) {
out.printf(
" <final_bytes_sent>%.0f</final_bytes_sent>\n",
final_bytes_sent
);
}
if (final_bytes_received) {
out.printf(
" <final_bytes_received>%.0f</final_bytes_received>\n",
final_bytes_received
);
}
if (to_server) {
out.printf(
" <app_version_num>%d</app_version_num>\n",
wup->version_num
);
}
n = (int)stderr_out.length();
if (n || to_server) {
out.printf("<stderr_out>\n");
// the following is here so that it gets recorded on server
// (there's no core_client_version field of result table)
//
if (to_server) {
out.printf(
"<core_client_version>%d.%d.%d</core_client_version>\n",
gstate.core_client_version.major,
gstate.core_client_version.minor,
gstate.core_client_version.release
);
}
if (n) {
out.printf("<![CDATA[\n");
out.printf("%s",stderr_out.c_str());
if (stderr_out[n-1] != '\n') {
out.printf("\n");
}
out.printf("]]>\n");
}
out.printf("</stderr_out>\n");
}
if (to_server) {
for (i=0; i<output_files.size(); i++) {
//.........这里部分代码省略.........