|
@@ -102,7 +102,7 @@ int restart_wait(struct thr_info *thr, unsigned int mstime)
|
|
|
return (thr->work_restart ? 0 : ETIMEDOUT);
|
|
return (thr->work_restart ? 0 : ETIMEDOUT);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- gettimeofday(&tv_now, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
timer_set_delay(&tv_timer, &tv_now, mstime * 1000);
|
|
timer_set_delay(&tv_timer, &tv_now, mstime * 1000);
|
|
|
while (true)
|
|
while (true)
|
|
|
{
|
|
{
|
|
@@ -118,7 +118,7 @@ int restart_wait(struct thr_info *thr, unsigned int mstime)
|
|
|
return 0;
|
|
return 0;
|
|
|
notifier_read(thr->work_restart_notifier);
|
|
notifier_read(thr->work_restart_notifier);
|
|
|
}
|
|
}
|
|
|
- gettimeofday(&tv_now, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -163,16 +163,16 @@ void minerloop_scanhash(struct thr_info *mythr)
|
|
|
work = get_and_prepare_work(mythr);
|
|
work = get_and_prepare_work(mythr);
|
|
|
if (!work)
|
|
if (!work)
|
|
|
break;
|
|
break;
|
|
|
- gettimeofday(&(work->tv_work_start), NULL);
|
|
|
|
|
|
|
+ timer_set_now(&work->tv_work_start);
|
|
|
|
|
|
|
|
do {
|
|
do {
|
|
|
thread_reportin(mythr);
|
|
thread_reportin(mythr);
|
|
|
/* Only allow the mining thread to be cancelled when
|
|
/* Only allow the mining thread to be cancelled when
|
|
|
* it is not in the driver code. */
|
|
* it is not in the driver code. */
|
|
|
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
|
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
|
|
- gettimeofday(&tv_start, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_start);
|
|
|
hashes = api->scanhash(mythr, work, work->blk.nonce + max_nonce);
|
|
hashes = api->scanhash(mythr, work, work->blk.nonce + max_nonce);
|
|
|
- gettimeofday(&tv_end, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_end);
|
|
|
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
|
|
pthread_testcancel();
|
|
pthread_testcancel();
|
|
|
thread_reportin(mythr);
|
|
thread_reportin(mythr);
|
|
@@ -276,7 +276,7 @@ void job_results_fetched(struct thr_info *mythr)
|
|
|
{
|
|
{
|
|
|
struct timeval tv_now;
|
|
struct timeval tv_now;
|
|
|
|
|
|
|
|
- gettimeofday(&tv_now, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
|
|
|
|
|
do_process_results(mythr, &tv_now, mythr->prev_work, true);
|
|
do_process_results(mythr, &tv_now, mythr->prev_work, true);
|
|
|
}
|
|
}
|
|
@@ -295,7 +295,7 @@ void mt_job_transition(struct thr_info *mythr)
|
|
|
{
|
|
{
|
|
|
struct timeval tv_now;
|
|
struct timeval tv_now;
|
|
|
|
|
|
|
|
- gettimeofday(&tv_now, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
|
|
|
|
|
if (mythr->starting_next_work)
|
|
if (mythr->starting_next_work)
|
|
|
{
|
|
{
|
|
@@ -314,7 +314,7 @@ void job_start_complete(struct thr_info *mythr)
|
|
|
{
|
|
{
|
|
|
struct timeval tv_now;
|
|
struct timeval tv_now;
|
|
|
|
|
|
|
|
- gettimeofday(&tv_now, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
|
|
|
|
|
do_process_results(mythr, &tv_now, mythr->prev_work, false);
|
|
do_process_results(mythr, &tv_now, mythr->prev_work, false);
|
|
|
}
|
|
}
|
|
@@ -358,7 +358,7 @@ void do_notifier_select(struct thr_info *thr, struct timeval *tvp_timeout)
|
|
|
int maxfd;
|
|
int maxfd;
|
|
|
fd_set rfds;
|
|
fd_set rfds;
|
|
|
|
|
|
|
|
- gettimeofday(&tv_now, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
FD_ZERO(&rfds);
|
|
FD_ZERO(&rfds);
|
|
|
FD_SET(thr->notifier[0], &rfds);
|
|
FD_SET(thr->notifier[0], &rfds);
|
|
|
maxfd = thr->notifier[0];
|
|
maxfd = thr->notifier[0];
|
|
@@ -403,7 +403,7 @@ void minerloop_async(struct thr_info *mythr)
|
|
|
|
|
|
|
|
while (likely(!cgpu->shutdown)) {
|
|
while (likely(!cgpu->shutdown)) {
|
|
|
tv_timeout.tv_sec = -1;
|
|
tv_timeout.tv_sec = -1;
|
|
|
- gettimeofday(&tv_now, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
for (proc = cgpu; proc; proc = proc->next_proc)
|
|
for (proc = cgpu; proc; proc = proc->next_proc)
|
|
|
{
|
|
{
|
|
|
mythr = proc->thr[0];
|
|
mythr = proc->thr[0];
|
|
@@ -488,7 +488,7 @@ void minerloop_queue(struct thr_info *thr)
|
|
|
|
|
|
|
|
while (likely(!cgpu->shutdown)) {
|
|
while (likely(!cgpu->shutdown)) {
|
|
|
tv_timeout.tv_sec = -1;
|
|
tv_timeout.tv_sec = -1;
|
|
|
- gettimeofday(&tv_now, NULL);
|
|
|
|
|
|
|
+ timer_set_now(&tv_now);
|
|
|
for (proc = cgpu; proc; proc = proc->next_proc)
|
|
for (proc = cgpu; proc; proc = proc->next_proc)
|
|
|
{
|
|
{
|
|
|
mythr = proc->thr[0];
|
|
mythr = proc->thr[0];
|