本文整理汇总了C++中dtime函数的典型用法代码示例。如果您正苦于以下问题:C++ dtime函数的具体用法?C++ dtime怎么用?C++ dtime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dtime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: handle_request
void handle_request(FILE* fin, FILE* fout, char* code_sign_key) {
SCHEDULER_REQUEST sreq;
SCHEDULER_REPLY sreply;
char buf[1024];
g_request = &sreq;
g_reply = &sreply;
g_wreq = &sreply.wreq;
sreply.nucleus_only = true;
log_messages.set_indent_level(1);
MIOFILE mf;
XML_PARSER xp(&mf);
mf.init_file(fin);
const char* p = sreq.parse(xp);
double start_time = dtime();
if (!p){
process_request(code_sign_key);
if ((config.locality_scheduling || config.locality_scheduler_fraction) && !sreply.nucleus_only) {
send_file_deletes();
}
} else {
sprintf(buf, "Error in request message: %s", p);
log_incomplete_request();
sreply.insert_message(buf, "low");
}
if (config.debug_user_messages) {
log_user_messages();
}
sreply.write(fout, sreq);
log_messages.printf(MSG_NORMAL,
"Scheduler ran %.3f seconds\n", dtime()-start_time
);
if (strlen(config.sched_lockfile_dir)) {
unlock_sched();
}
}
开发者ID:FpgaAtHome,项目名称:seti_fpga,代码行数:43,代码来源:handle_request.cpp
示例2: calloc
static lcc_value_list_t *create_value_list (void) /* {{{ */
{
lcc_value_list_t *vl;
int host_num;
vl = calloc (1, sizeof (*vl));
if (vl == NULL)
{
fprintf (stderr, "calloc failed.\n");
return (NULL);
}
vl->values = calloc (/* nmemb = */ 1, sizeof (*vl->values));
if (vl->values == NULL)
{
fprintf (stderr, "calloc failed.\n");
free (vl);
return (NULL);
}
vl->values_types = calloc (/* nmemb = */ 1, sizeof (*vl->values_types));
if (vl->values_types == NULL)
{
fprintf (stderr, "calloc failed.\n");
free (vl->values);
free (vl);
return (NULL);
}
vl->values_len = 1;
host_num = get_boundet_random (0, conf_num_hosts);
vl->interval = conf_interval;
vl->time = 1.0 + dtime ()
+ (host_num % (1 + (int) vl->interval));
if (get_boundet_random (0, 2) == 0)
vl->values_types[0] = LCC_TYPE_GAUGE;
else
vl->values_types[0] = LCC_TYPE_DERIVE;
snprintf (vl->identifier.host, sizeof (vl->identifier.host),
"host%04i", host_num);
snprintf (vl->identifier.plugin, sizeof (vl->identifier.plugin),
"plugin%03i", get_boundet_random (0, conf_num_plugins));
strncpy (vl->identifier.type,
(vl->values_types[0] == LCC_TYPE_GAUGE) ? "gauge" : "derive",
sizeof (vl->identifier.type));
vl->identifier.type[sizeof (vl->identifier.type) - 1] = 0;
snprintf (vl->identifier.type_instance, sizeof (vl->identifier.type_instance),
"ti%li", random ());
return (vl);
} /* }}} int create_value_list */
开发者ID:beorn-,项目名称:collectd,代码行数:55,代码来源:collectd-tg.c
示例3: main
// add your sensor class below, i.e. CSensorTest
int main(int argc, char** argv)
{
const float RUN_SECONDS = 100.0f; // how many seconds to run -- max is 200 seconds (or bump up MAXI in define.h to RUN_SECONDS / DT )
int iRetVal = 0, iErrCnt = 0;
sm = new CQCNShMem();
CSensorLinuxUSBONavi sms;
if (sms.detect()) {
double tstart = dtime(), tend;
// initialize timers
sm->t0active = tstart; // use the function in boinc/lib
sm->t0check = sm->t0active + sm->dt;
// MySQL
sms.connectDatabase();
// assuming we're at 50Hz, run 500 times for 10 seconds of output, note array only holds 10,000 so don't go past that!
//sm->lOffset++; //debug
//for (sm->lOffset = 0; sm->lOffset < (int) (RUN_SECONDS / DT); sm->lOffset++) { //debug
while(true){
if (!sms.mean_xyz(true)) iErrCnt++; // pass in true for verbose output, false for silent
}
tend = dtime();
fprintf(stdout, "%f seconds of samples read from %f to %f in %f seconds real time -- error of %3.3f %c\n"
"%d Timing Errors Encountered\n",
RUN_SECONDS, tstart, tend, tend - tstart, ((RUN_SECONDS - (tend - tstart)) / RUN_SECONDS) * 100.0f, '%', iErrCnt);
}
else {
fprintf(stdout, "No sensor detected!\n");
iRetVal = 1;
}
if (sm) {
delete sm;
sm = NULL;
}
return iRetVal;
}
开发者ID:hirokiu,项目名称:csn_raspi,代码行数:43,代码来源:main.cpp
示例4: test_equalizer_chain_pth
void test_equalizer_chain_pth(LTE_PHY_PARAMS *lte_phy_params)
{
double tstart, tend, ttime;
GeneRandomInput((lte_phy_params + 0)->ofdemod_in, (lte_phy_params + 0)->ofdemod_in_buf_sz, "./testsuite/SubCarrierMapInputReal", "./testsuite/SubCarrierMapInputImag");
GeneRandomInput((lte_phy_params + 1)->ofdemod_in, (lte_phy_params + 1)->ofdemod_in_buf_sz, "./testsuite/SubCarrierMapInputReal", "./testsuite/SubCarrierMapInputImag");
GeneRandomInput((lte_phy_params + 2)->ofdemod_in, (lte_phy_params + 2)->ofdemod_in_buf_sz, "./testsuite/SubCarrierMapInputReal", "./testsuite/SubCarrierMapInputImag");
tstart = dtime();
equalizer_chain_pth(lte_phy_params);
tend = dtime();
ttime = tend - tstart;
printf("%.3fms\n", ttime);
WriteOutputToFiles((lte_phy_params + 0)->eq_out, (lte_phy_params + 0)->eq_out_buf_sz, "./testsuite/testLSCELSEqOutputReal", "./testsuite/testLSCELSEqOutputImag");
WriteOutputToFiles((lte_phy_params + 1)->eq_out, (lte_phy_params + 1)->eq_out_buf_sz, "./testsuite/testLSCELSEqOutputReal", "./testsuite/testLSCELSEqOutputImag");
WriteOutputToFiles((lte_phy_params + 2)->eq_out, (lte_phy_params + 2)->eq_out_buf_sz, "./testsuite/testLSCELSEqOutputReal", "./testsuite/testLSCELSEqOutputImag");
}
开发者ID:troore,项目名称:unico,代码行数:20,代码来源:test.cpp
示例5: timer_handler
static VOID CALLBACK timer_handler(HWND, UINT, UINT, DWORD) {
RECT rt;
int width, height;
char buf[MSG_CHANNEL_SIZE];
if (g_sleep) return;
// check for graphics-related message from core client
//
if (app_client_shm) {
if (app_client_shm->shm->graphics_request.get_msg(buf)) {
BOINCINFO("Received Graphics Message: %s", buf);
app_client_shm->decode_graphics_msg(buf, graphics_msg);
switch (graphics_msg.mode) {
case MODE_REREAD_PREFS:
// only reread graphics prefs if we have a window open
//
switch(current_graphics_mode) {
case MODE_WINDOW:
case MODE_FULLSCREEN:
app_graphics_reread_prefs();
break;
}
break;
case MODE_HIDE_GRAPHICS:
case MODE_WINDOW:
case MODE_FULLSCREEN:
case MODE_BLANKSCREEN:
set_mode(graphics_msg.mode);
break;
}
}
// ack graphics mode
//
if (acked_graphics_mode != current_graphics_mode) {
bool sent = app_client_shm->shm->graphics_reply.send_msg(
xml_graphics_modes[current_graphics_mode]
);
if (sent) acked_graphics_mode = current_graphics_mode;
}
}
if (!visible) return;
if (current_graphics_mode == MODE_HIDE_GRAPHICS) return;
if (!hWnd) return;
// TODO: remove width, height from API
//
GetClientRect(hWnd, &rt);
width = rt.right-rt.left;
height = rt.bottom-rt.top;
if (throttled_app_render(width, height, dtime())) {
SwapBuffers(hDC);
}
}
开发者ID:drshawnkwang,项目名称:boinc,代码行数:54,代码来源:windows_opengl.cpp
示例6: callback
void callback(struct libusb_transfer *xfr) {
if (xfr->status!=LIBUSB_TRANSFER_COMPLETED) {
fprintf(stderr,"Transfer failed: %d\n",xfr->status);
exit(1);
}
transfer(xfr);
total += xfr->length;
double rate = total/(dtime()-t);
fprintf(stderr,"%10d %lf\n",total,rate);
}
开发者ID:amcinnes,项目名称:uc_am_xmit,代码行数:11,代码来源:write.c
示例7: bucketsort
int bucketsort(void **a, size_t n, keyaccessor_t key, indexer_t idx,
comparator_t cmp)
{
_cons_t *lists = (_cons_t *) malloc(n * sizeof(_cons_t));
if (!lists) {
perror("malloc failed!");
return -1;
}
#if BUCKETSORT_PROFILE
when = dtime(); array2list(a, lists, n); ptime();
when = dtime(); list_t l = bucketsort_l(lists, key, idx, cmp); ptime();
when = dtime(); list2array(l, a, n); ptime();
#else
array2list(a, lists, n);
list_t l = bucketsort_l(lists, key, idx, cmp);
list2array(l, a, n);
#endif
free(lists);
return 0;
}
开发者ID:dankogai,项目名称:c-bucketsort,代码行数:20,代码来源:bucketsort.c
示例8: delete_project_owned_file
/// Delete the file located at path.
/// If "retry" is set, do retries for 5 sec in case some
/// other program (e.g. virus checker) has the file locked.
/// Don't do this if deleting directories - it can lock up the Manager.
///
/// \param[in] path The path name of the file that should be deleted.
/// \param[in] retry If true this function will try to delete the file
/// multiple times if the first attempt failed.
/// \return Zero on success, ERR_UNLINK on error.
int delete_project_owned_file(const char* path, bool retry) {
int retval = 0;
if (!boinc_file_or_symlink_exists(path)) {
return 0;
}
retval = delete_project_owned_file_aux(path);
if (retval && retry) {
double start = dtime();
do {
boinc_sleep(drand() * 2.0); // avoid lockstep
retval = delete_project_owned_file_aux(path);
if (!retval) break;
} while (dtime() < start + FILE_RETRY_INTERVAL);
}
if (retval) {
safe_strcpy(boinc_failed_file, path);
return ERR_UNLINK;
}
return 0;
}
开发者ID:phenix3443,项目名称:synecdoche,代码行数:30,代码来源:sandbox.C
示例9: FD_ZERO
int RPC_CLIENT::init_poll() {
fd_set read_fds, write_fds, error_fds;
struct timeval tv;
int retval;
FD_ZERO(&read_fds);
FD_ZERO(&write_fds);
FD_ZERO(&error_fds);
FD_SET(sock, &read_fds);
FD_SET(sock, &write_fds);
FD_SET(sock, &error_fds);
BOINCTRACE("RPC_CLIENT::init_poll sock = %d\n", sock);
tv.tv_sec = tv.tv_usec = 0;
select(FD_SETSIZE, &read_fds, &write_fds, &error_fds, &tv);
retval = 0;
if (FD_ISSET(sock, &error_fds)) {
retval = ERR_CONNECT;
} else if (FD_ISSET(sock, &write_fds)) {
retval = get_socket_error(sock);
if (!retval) {
BOINCTRACE("RPC_CLIENT::init_poll connected to port %d\n", ntohs(addr.sin_port));
retval = boinc_socket_asynch(sock, false);
if (retval) {
BOINCTRACE("asynch error: %d\n", retval);
return retval;
}
return 0;
} else {
BOINCTRACE("init_poll: get_socket_error(): %d\n", retval);
}
}
if (dtime() > start_time + timeout) {
BOINCTRACE("RPC_CLIENT init timed out\n");
return ERR_CONNECT;
}
if (retval) {
if (retry) {
boinc_close_socket(sock);
retval = boinc_socket(sock);
retval = boinc_socket_asynch(sock, true);
retval = connect(sock, (const sockaddr*)(&addr), sizeof(addr));
BOINCTRACE("RPC_CLIENT::init_poll attempting connect\n");
return ERR_RETRY;
} else {
return ERR_CONNECT;
}
}
return ERR_RETRY;
}
开发者ID:phenix3443,项目名称:synecdoche,代码行数:52,代码来源:gui_rpc_client.C
示例10: main_loop
void main_loop() {
int retval;
int node=0,n;
while (node<n1) {
check_stop_daemons();
retval = count_unsent_results(n, 0);
if (retval) {
log_messages.printf(MSG_CRITICAL,
"count_unsent_jobs() failed: %s\n", boincerror(retval)
);
exit(retval);
}
if (n > CUSHION) {
daemon_sleep(5);
} else {
// int njobs = (CUSHION-n)/REPLICATION_FACTOR;
log_messages.printf(MSG_DEBUG,
"Making job for %d\n", node
);
// for (int i=0; i<njobs; i++) {
for (int i=0; i<n1; i+=CLIENT_LIMIT)
{
retval = make_job(node,i);
if (retval) {
log_messages.printf(MSG_CRITICAL,
"can't make job: %s\n", boincerror(retval)
);
exit(retval);
}
}
// }
// Now sleep for a few seconds to let the transitioner
// create instances for the jobs we just created.
// Otherwise we could end up creating an excess of jobs.
double now = dtime();
while (1) {
daemon_sleep(5);
double x;
retval = min_transition_time(x);
if (retval) {
log_messages.printf(MSG_CRITICAL,
"min_transition_time failed: %s\n", boincerror(retval)
);
exit(retval);
}
if (x > now) break;
}
}
node++;
}
}
开发者ID:godlytalias,项目名称:BOINC,代码行数:52,代码来源:work_generator.cpp
示例11: tx_rate_matching
void tx_rate_matching(LTE_PHY_PARAMS *lte_phy_params)
{
std::cout << "Tx RateMatching starts" << std::endl;
//ReadInputFromFiles(lte_phy_params->rm_in, lte_phy_params->rm_in_buf_sz, "../testsuite/RandomTxRateMatchInput");
GeneRandomInput(lte_phy_params->rm_in, lte_phy_params->rm_in_buf_sz, "/root/RateMatching/testsuite/RandomTxRateMatchInput");
TxRateMatching(lte_phy_params, lte_phy_params->rm_in, lte_phy_params->rm_out);
double energy,ttime,tbegin;
micpower_start();
tbegin = dtime();
for(int i=0;i<10000;i++)
TxRateMatching(lte_phy_params, lte_phy_params->rm_in, lte_phy_params->rm_out);
ttime = dtime() - tbegin;
energy = micpower_finalize();
// printf("Energy used in %lf\n", energy);
// printf("whole time is %fms\n", ttime);
printf("%lf\t%f\t%f\n", energy, ttime, (energy * 1000.0) / ttime);
WriteOutputToFiles(lte_phy_params->rm_out, lte_phy_params->rm_out_buf_sz, "/root/RateMatching/testsuite/testTxRateMatchOutput");
std::cout << "Tx RateMatching ends" << std::endl;
}
开发者ID:troore,项目名称:ParWiBench,代码行数:22,代码来源:test.cpp
示例12: test_turbo_decoding
void test_turbo_decoding(LTE_PHY_PARAMS *lte_phy_params, int n_log_decoder_iters)
{
std::cout << "Turbo Decoder starts" << std::endl;
ReadInputFromFiles(lte_phy_params->td_in, lte_phy_params->td_in_buf_sz, "../testsuite/testTurboEncoderOutput");
for (int i = 0; i < lte_phy_params->td_in_buf_sz; i++)
{
lte_phy_params->td_in[i] = (1 - 2 * lte_phy_params->td_in[i]);
}
double tstart, tend, ttime;
double n_gflops, gflops;
tstart = dtime();
int n_test_iters = 1;
for (int i = 0; i < n_test_iters; i++)
{
turbo_decoding(lte_phy_params, lte_phy_params->td_in, lte_phy_params->td_out, n_log_decoder_iters);
}
tend = dtime();
ttime = tend - tstart;
n_gflops = n_test_iters * gflop_counter(lte_phy_params);
gflops = (n_gflops * 10e3) / ttime;
// printf("%fms\n", ttime);
// printf("Number of gflops = %lf\n", n_gflops);
// printf("GFlops = %f\n", gflops);
for (int i = 0; i < lte_phy_params->td_out_buf_sz; i++)
{
lte_phy_params->td_out[i] = (1 - lte_phy_params->td_out[i]) / 2;
}
WriteOutputToFiles(lte_phy_params->td_out, lte_phy_params->td_out_buf_sz, "../testsuite/testTurboDecoderOutput");
std::cout << "Turbo Decoder ends" << std::endl;
}
开发者ID:troore,项目名称:ParWiBench,代码行数:39,代码来源:test.cpp
示例13: defaults
void GLOBAL_PREFS::parse(const char* buf, const char* venue) {
char buf2[BLOB_SIZE];
double dtemp;
defaults();
if (parse_double(buf, "<mod_time>", mod_time)) {
// mod_time is outside of venue
if (mod_time > dtime()) mod_time = dtime();
}
extract_venue(buf, venue, buf2);
parse_double(buf2, "<disk_max_used_gb>", disk_max_used_gb);
parse_double(buf2, "<disk_max_used_pct>", disk_max_used_pct);
parse_double(buf2, "<disk_min_free_gb>", disk_min_free_gb);
parse_double(buf2, "<work_buf_min_days>", work_buf_min_days);
if (parse_double(buf2, "<ram_max_used_busy_pct>", dtemp)) {
ram_max_used_busy_frac = dtemp/100.;
}
if (parse_double(buf2, "<ram_max_used_idle_pct>", dtemp)) {
ram_max_used_idle_frac = dtemp/100.;
}
parse_double(buf2, "<max_ncpus_pct>", max_ncpus_pct);
}
开发者ID:freehal,项目名称:boinc-freehal,代码行数:23,代码来源:sched_types.cpp
示例14: writefile
void writefile () {
if (!activevents) errx(1,"Internal error");
E("write", write(1, header, sizeof(header)));
struct timeval lastime = events[0].time;
int remain = activevents;
for (ME* cur = events; remain; remain--, cur++) {
write_variable_length_quantity(dtime(lastime, cur->time));
lastime = cur->time;
mm_write(1, &cur->m); }
E("write", write(1, trailer, sizeof(trailer)));
off_t ending_offset;
E("lseek", (ending_offset = lseek(1, 0, SEEK_CUR)));
E("lseek", lseek(1, 18, SEEK_SET));
write_four_byte_int(ending_offset - sizeof(header), 1); }
开发者ID:bsummer4,项目名称:midiutils,代码行数:14,代码来源:brainstorm.c
示例15: main_loop
void main_loop() {
int retval;
while (1) {
check_stop_daemons();
long n;
retval = count_unsent_results(n, app.id);
if (retval) {
log_messages.printf(MSG_CRITICAL,
"count_unsent_jobs() failed: %s\n", boincerror(retval)
);
exit(retval);
}
if (n > CUSHION) {
daemon_sleep(10);
} else {
int njobs = (CUSHION-n)/REPLICATION_FACTOR;
log_messages.printf(MSG_DEBUG,
"Making %d jobs\n", njobs
);
for (int i=0; i<njobs; i++) {
retval = make_job();
if (retval) {
log_messages.printf(MSG_CRITICAL,
"can't make job: %s\n", boincerror(retval)
);
exit(retval);
}
}
// Wait for the transitioner to create instances
// of the jobs we just created.
// Otherwise we'll create too many jobs.
//
double now = dtime();
while (1) {
daemon_sleep(5);
double x;
retval = min_transition_time(x);
if (retval) {
log_messages.printf(MSG_CRITICAL,
"min_transition_time failed: %s\n", boincerror(retval)
);
exit(retval);
}
if (x > now) break;
}
}
}
}
开发者ID:WilliamStilte,项目名称:boinc,代码行数:49,代码来源:sample_work_generator.cpp
示例16: delete_project_owned_file
// Delete the file located at path.
// If "retry" is set, do retries for 5 sec in case some
// other program (e.g. virus checker) has the file locked.
// Don't do this if deleting directories - it can lock up the Manager.
//
int delete_project_owned_file(const char* path, bool retry) {
int retval = 0;
if (!boinc_file_or_symlink_exists(path)) {
return 0;
}
retval = delete_project_owned_file_aux(path);
if (retval && retry) {
double start = dtime();
do {
boinc_sleep(drand()*2); // avoid lockstep
retval = delete_project_owned_file_aux(path);
if (!retval) break;
} while (dtime() < start + FILE_RETRY_INTERVAL);
}
if (retval) {
safe_strcpy(boinc_failed_file, path);
return ERR_UNLINK;
}
if (log_flags.slot_debug) {
msg_printf(0, MSG_INFO, "[slot] removed file %s", path);
}
return 0;
}
开发者ID:freehal,项目名称:boinc-freehal,代码行数:29,代码来源:sandbox.cpp
示例17: Thermostat
Nose_Hoover::Nose_Hoover(Box& box, double dt, double temp, double a_q1, double a_q2 )
: Thermostat(box, dt),
TargetTemperature(temp)
, q1(a_q1)
, q2(a_q2)
, xi1(0.0)
, xi2(0.0)
, nuxi1(0.0)
, nuxi2(0.0)
, g1(0.0)
, g2(0.0) {
DeltaTHalf = 0.5*dt;
DeltaT4 = 0.5*DeltaTHalf;
DeltaT8 = 0.5*DeltaT4;
update_temp();
dtime(dt);
SimBox.calculate_forces();
}
开发者ID:paddy3,项目名称:StarPolymersMD,代码行数:18,代码来源:Nose_Hoover.cpp
示例18: addProperty
void CDlgItemProperties::show_rsc(wxString rsc_name, RSC_DESC rsc_desc) {
if (rsc_desc.no_rsc_pref) {
addProperty(_("Don't fetch tasks for ") + rsc_name, _("Project preference"));
}
if (rsc_desc.no_rsc_ams) {
addProperty(_("Don't fetch tasks for ") + rsc_name, _("Account manager preference"));
}
if (rsc_desc.no_rsc_apps) {
addProperty(_("Don't fetch tasks for ") + rsc_name, _("Project has no apps for ") + rsc_name);
}
if (rsc_desc.no_rsc_config) {
addProperty(_("Don't fetch tasks for ") + rsc_name, _("Client configuration excludes ") + rsc_name);
}
double x = rsc_desc.backoff_time - dtime();
if (x<0) x = 0;
addProperty(rsc_name + _(" work fetch deferred for"), FormatTime(x));
addProperty(rsc_name + _(" work fetch deferral interval"), FormatTime(rsc_desc.backoff_interval));
}
开发者ID:abergstr,项目名称:BOINC,代码行数:18,代码来源:DlgItemProperties.cpp
示例19: get_delay_bound_range
// return the delay bound to use for this job/host.
// Actually, return two: optimistic (lower) and pessimistic (higher).
// If the deadline check with the optimistic bound fails,
// try the pessimistic bound.
// TODO: clean up this mess
//
static void get_delay_bound_range(
WORKUNIT& wu,
int res_server_state, int res_priority, double res_report_deadline,
BEST_APP_VERSION& bav,
double& opt, double& pess
) {
if (res_server_state == RESULT_SERVER_STATE_IN_PROGRESS) {
double now = dtime();
if (res_report_deadline < now) {
// if original deadline has passed, return zeros
// This will skip deadline check.
opt = pess = 0;
return;
}
opt = res_report_deadline - now;
pess = wu.delay_bound;
} else {
opt = pess = wu.delay_bound;
// If the workunit needs reliable and is being sent to a reliable host,
// then shorten the delay bound by the percent specified
//
if (config.reliable_on_priority && res_priority >= config.reliable_on_priority && config.reliable_reduced_delay_bound > 0.01
) {
opt = wu.delay_bound*config.reliable_reduced_delay_bound;
double est_wallclock_duration = estimate_duration(wu, bav);
// Check to see how reasonable this reduced time is.
// Increase it to twice the estimated delay bound
// if all the following apply:
//
// 1) Twice the estimate is longer then the reduced delay bound
// 2) Twice the estimate is less then the original delay bound
// 3) Twice the estimate is less then the twice the reduced delay bound
if (est_wallclock_duration*2 > opt
&& est_wallclock_duration*2 < wu.delay_bound
&& est_wallclock_duration*2 < wu.delay_bound*config.reliable_reduced_delay_bound*2
) {
opt = est_wallclock_duration*2;
}
}
}
}
开发者ID:AltroCoin,项目名称:altrocoin,代码行数:49,代码来源:sched_check.cpp
示例20: handle_add
int handle_add(const char* path) {
char dir[256], filename[256], buf[1024];
DB_VDA_FILE vf;
POLICY policy;
double size;
int retval;
retval = file_size(path, size);
if (retval) {
fprintf(stderr, "no file %s\n", path);
return -1;
}
strcpy(dir, path);
char* p = strrchr(dir, '/');
*p = 0;
strcpy(filename, p+1);
// make sure there's a valid policy file in the dir
//
sprintf(buf, "%s/boinc_meta.txt", dir);
retval = policy.parse(buf);
if (retval) {
fprintf(stderr, "Can't parse policy file.\n");
return -1;
}
// add a DB record and mark it for update
//
vf.create_time = dtime();
strcpy(vf.dir, dir);
strcpy(vf.name, filename);
vf.size = size;
vf.need_update = 1;
vf.initialized = 0;
retval = vf.insert();
if (retval) {
fprintf(stderr, "Can't insert DB record\n");
return -1;
}
return 0;
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:42,代码来源:vda.cpp
注:本文中的dtime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论