struct pending_request *req = (struct pending_request *)arg;
enum async_action action;
struct timespec ts_now;
- struct timeval now;
- if (gettimeofday(&now, NULL) < 0) {
+ if (clock_gettime(CLOCK_MONOTONIC, &ts_now) < 0) {
RTE_LOG(ERR, EAL, "Cannot get current time\n");
goto no_trigger;
}
- ts_now.tv_nsec = now.tv_usec * 1000;
- ts_now.tv_sec = now.tv_sec;
action = process_async_request(req, &ts_now);
struct rte_mp_reply *reply, const struct timespec *ts)
{
int ret;
+ pthread_condattr_t attr;
struct rte_mp_msg msg, *tmp;
struct pending_request pending_req, *exist;
strlcpy(pending_req.dst, dst, sizeof(pending_req.dst));
pending_req.request = req;
pending_req.reply = &msg;
- pthread_cond_init(&pending_req.sync.cond, NULL);
+ pthread_condattr_init(&attr);
+ pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
+ pthread_cond_init(&pending_req.sync.cond, &attr);
exist = find_pending_request(dst, req->name);
if (exist) {
int dir_fd, ret = -1;
DIR *mp_dir;
struct dirent *ent;
- struct timeval now;
- struct timespec end;
+ struct timespec now, end;
const struct internal_config *internal_conf =
eal_get_internal_configuration();
return -1;
}
- if (gettimeofday(&now, NULL) < 0) {
+ if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) {
RTE_LOG(ERR, EAL, "Failed to get current time\n");
rte_errno = errno;
goto end;
}
- end.tv_nsec = (now.tv_usec * 1000 + ts->tv_nsec) % 1000000000;
+ end.tv_nsec = (now.tv_nsec + ts->tv_nsec) % 1000000000;
end.tv_sec = now.tv_sec + ts->tv_sec +
- (now.tv_usec * 1000 + ts->tv_nsec) / 1000000000;
+ (now.tv_nsec + ts->tv_nsec) / 1000000000;
/* for secondary process, send request to the primary process only */
if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
int dir_fd, ret = 0;
DIR *mp_dir;
struct dirent *ent;
- struct timeval now;
+ struct timespec now;
struct timespec *end;
bool dummy_used = false;
const struct internal_config *internal_conf =
return -1;
}
- if (gettimeofday(&now, NULL) < 0) {
+ if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) {
RTE_LOG(ERR, EAL, "Failed to get current time\n");
rte_errno = errno;
return -1;
end = ¶m->end;
reply = ¶m->user_reply;
- end->tv_nsec = (now.tv_usec * 1000 + ts->tv_nsec) % 1000000000;
+ end->tv_nsec = (now.tv_nsec + ts->tv_nsec) % 1000000000;
end->tv_sec = now.tv_sec + ts->tv_sec +
- (now.tv_usec * 1000 + ts->tv_nsec) / 1000000000;
+ (now.tv_nsec + ts->tv_nsec) / 1000000000;
reply->nb_sent = 0;
reply->nb_received = 0;
reply->msgs = NULL;