您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ time_msec函数代码示例

51自学网 2021-06-03 08:50:43
  C++
这篇教程C++ time_msec函数代码示例写得很实用,希望能帮到您。

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

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

示例1: classifierd_wait

voidclassifierd_wait(void){    if (classifierd_run_timer) {        poll_timer_wait_until(time_msec() +                              CLASSIFIERD_RUN_TIMER_INTERVAL_MSEC);        classifierd_run_timer = false;    }    ovsdb_idl_wait(idl);} /* classifierd_wait */
开发者ID:open-switch,项目名称:ops-classifierd,代码行数:10,


示例2: jsonrpc_session_open_unreliably

/* Creates and returns a jsonrpc_session that is initially connected to * 'jsonrpc'.  If the connection is dropped, it will not be reconnected. * * On the assumption that such connections are likely to be short-lived * (e.g. from ovs-vsctl), informational logging for them is suppressed. */struct jsonrpc_session *jsonrpc_session_open_unreliably(struct jsonrpc *jsonrpc, uint8_t dscp){    struct jsonrpc_session *s;    s = xmalloc(sizeof *s);    s->reconnect = reconnect_create(time_msec());    reconnect_set_quiet(s->reconnect, true);    reconnect_set_name(s->reconnect, jsonrpc_get_name(jsonrpc));    reconnect_set_max_tries(s->reconnect, 0);    reconnect_connected(s->reconnect, time_msec());    s->dscp = dscp;    s->rpc = jsonrpc;    s->stream = NULL;    s->pstream = NULL;    s->seqno = 0;    return s;}
开发者ID:dariobanfi,项目名称:ovs-multipath,代码行数:24,


示例3: wait_timeout

static voidwait_timeout(long long int started){    long long int now = time_msec();    long long int timeout = 10000 - (now - started);    if (timeout <= 0) {        poll_immediate_wake();    } else {        poll_timer_wait(timeout);    }}
开发者ID:mobilipia,项目名称:iods,代码行数:11,


示例4: flow_entry_hard_timeout

boolflow_entry_hard_timeout(struct flow_entry *entry) {    bool timeout;    timeout = (entry->remove_at != 0) && (time_msec() > entry->remove_at);    if (timeout) {        flow_entry_remove(entry, OFPRR_HARD_TIMEOUT);    }    return timeout;}
开发者ID:lindadunbar,项目名称:of11softswitch,代码行数:11,


示例5: jsonrpc_session_open

/* Creates and returns a jsonrpc_session to 'name', which should be a string * acceptable to stream_open() or pstream_open(). * * If 'name' is an active connection method, e.g. "tcp:127.1.2.3", the new * jsonrpc_session connects and reconnects, with back-off, to 'name'. * * If 'name' is a passive connection method, e.g. "ptcp:", the new * jsonrpc_session listens for connections to 'name'.  It maintains at most one * connection at any given time.  Any new connection causes the previous one * (if any) to be dropped. */struct jsonrpc_session *jsonrpc_session_open(const char *name){    struct jsonrpc_session *s;    s = xmalloc(sizeof *s);    s->reconnect = reconnect_create(time_msec());    reconnect_set_name(s->reconnect, name);    reconnect_enable(s->reconnect, time_msec());    s->rpc = NULL;    s->stream = NULL;    s->pstream = NULL;    s->seqno = 0;    if (!pstream_verify_name(name)) {        reconnect_set_passive(s->reconnect, true, time_msec());    }    return s;}
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:30,


示例6: refill_bucket

/* Add tokens to the bucket based on elapsed time. */static voidrefill_bucket(struct rate_limiter *rl){    const struct settings *s = rl->s;    long long int now = time_msec();    long long int tokens = (now - rl->last_fill) * s->rate_limit + rl->tokens;    if (tokens >= 1000) {        rl->last_fill = now;        rl->tokens = MIN(tokens, s->burst_limit * 1000);    }}
开发者ID:CPqD,项目名称:of11softswitch,代码行数:12,


示例7: flow_entry_idle_timeout

boolflow_entry_idle_timeout(struct flow_entry *entry) {    bool timeout;    timeout = (entry->stats->idle_timeout != 0) &&              (time_msec() > entry->last_used + entry->stats->idle_timeout * 1000);    if (timeout) {        flow_entry_remove(entry, OFPRR_IDLE_TIMEOUT);    }    return timeout;}
开发者ID:lindadunbar,项目名称:of11softswitch,代码行数:12,


示例8: create_new_tcp_buf

/* Creates a new TCP buffer with key flow_id and returns its pointer */struct tcp_buf * create_new_tcp_buf(uint32_t flow_id){    struct tcp_buf * tcp_buf;    tcp_buffers_count++;    tcp_buf = malloc (sizeof (struct tcp_buf));    tcp_buf->flow_id = flow_id;    tcp_buf->inserted_items = 0;    tcp_buf->consecutive_buffering_events = 0;    tcp_buf->expected_seqnum = -1;    tcp_buf->timeout = time_msec();    tcp_buf->fin_state = false;    return tcp_buf;}
开发者ID:dariobanfi,项目名称:ovs-multipath,代码行数:13,


示例9: elapsed_time

/* Return a well formatted string with a time difference at millisecond resolution */char * elapsed_time (struct timeval * start, struct timeval * stop){  static char et [64];  time_t elapsed = delta_time_in_milliseconds (stop, start);  if (time_day (elapsed))    sprintf (et, "%d days, %02d:%02d:%02d.%03ld",	     time_day (elapsed), time_hour (elapsed), time_min (elapsed), time_sec (elapsed), time_usec (elapsed));  else if (time_hour (elapsed))    sprintf (et, "%02d:%02d:%02d.%03ld",	     time_hour (elapsed), time_min (elapsed), time_sec (elapsed), time_usec (elapsed));  else if (time_min (elapsed))    sprintf (et, "%02d:%02d.%03ld", time_min (elapsed), time_sec (elapsed), time_usec (elapsed));  else if (time_sec (elapsed))    sprintf (et, "%d.%03d secs", time_sec (elapsed), time_msec (elapsed));  else    sprintf (et, "%3d msecs", time_msec (elapsed));  return et;}
开发者ID:rcarbone,项目名称:ark,代码行数:22,


示例10: fail_open_run

/* Enter fail-open mode if we should be in it. */voidfail_open_run(struct fail_open *fo){    int disconn_secs = connmgr_failure_duration(fo->connmgr);    /* Enter fail-open mode if 'fo' is not in it but should be.  */    if (disconn_secs >= trigger_duration(fo)) {        if (!fail_open_is_active(fo)) {            VLOG_WARN("Could not connect to controller (or switch failed "                      "controller's post-connection admission control "                      "policy) for %d seconds, failing open", disconn_secs);            fo->last_disconn_secs = disconn_secs;            /* Flush all OpenFlow and datapath flows.  We will set up our             * fail-open rule from fail_open_flushed() when             * ofproto_flush_flows() calls back to us. */            ofproto_flush_flows(fo->ofproto);        } else if (disconn_secs > fo->last_disconn_secs + 60) {            VLOG_INFO("Still in fail-open mode after %d seconds disconnected "                      "from controller", disconn_secs);            fo->last_disconn_secs = disconn_secs;        }    }    /* Schedule a bogus packet-in if we're connected and in fail-open. */    if (fail_open_is_active(fo)) {        if (connmgr_is_any_controller_connected(fo->connmgr)) {            bool expired = time_msec() >= fo->next_bogus_packet_in;            if (expired) {                send_bogus_packet_ins(fo);            }            if (expired || fo->next_bogus_packet_in == LLONG_MAX) {                fo->next_bogus_packet_in = time_msec() + 2000;            }        } else {            fo->next_bogus_packet_in = LLONG_MAX;        }    }}
开发者ID:asteven,项目名称:openvswitch,代码行数:41,


示例11: flow_entry_bv_create

struct flow_entry_bv *flow_entry_bv_create(struct datapath *dp, struct flow_table_bv *table, struct ofl_msg_flow_mod *mod) {    struct flow_entry_bv *entry;    uint64_t now = time_msec();    entry = xmalloc(sizeof(struct flow_entry_bv));    entry->dp    = dp;    entry->table = table;     entry->stats = xmalloc(sizeof(struct ofl_flow_stats));     entry->stats->table_id         = mod->table_id;    entry->stats->duration_sec     = 0;    entry->stats->duration_nsec    = 0;    entry->stats->priority         = mod->priority;    entry->stats->idle_timeout     = mod->idle_timeout;    entry->stats->hard_timeout     = mod->hard_timeout;    entry->stats->cookie           = mod->cookie;    entry->no_pkt_count = ((mod->flags & OFPFF_NO_PKT_COUNTS) != 0 );    entry->no_byt_count = ((mod->flags & OFPFF_NO_BYT_COUNTS) != 0 );    if (entry->no_pkt_count)        entry->stats->packet_count     = 0xffffffffffffffff;    else        entry->stats->packet_count     = 0;    if (entry->no_byt_count)        entry->stats->byte_count       = 0xffffffffffffffff;    else        entry->stats->byte_count       = 0;    entry->stats->match            = mod->match;    entry->stats->instructions_num = mod->instructions_num;    entry->stats->instructions     = mod->instructions;    entry->match = mod->match; /* TODO: MOD MATCH? */    entry->created      = now;    entry->remove_at    = mod->hard_timeout == 0 ? 0                                  : now + mod->hard_timeout * 1000;    entry->last_used    = now;    entry->send_removed = ((mod->flags & OFPFF_SEND_FLOW_REM) != 0);    list_init(&entry->match_node);    list_init(&entry->idle_node);    list_init(&entry->hard_node);    list_init(&entry->group_refs);    init_group_refs(entry);    list_init(&entry->meter_refs);    init_meter_refs(entry);    return entry;}
开发者ID:shager,项目名称:mojito,代码行数:52,


示例12: time_alarm

/* Configures the program to die with SIGALRM 'secs' seconds from now, if * 'secs' is nonzero, or disables the feature if 'secs' is zero. */voidtime_alarm(unsigned int secs){    long long int now;    long long int msecs;    assert_single_threaded();    time_init();    now = time_msec();    msecs = secs * 1000LL;    deadline = now < LLONG_MAX - msecs ? now + msecs : LLONG_MAX;}
开发者ID:David-B55,项目名称:ovs,代码行数:15,


示例13: format_odp_flow_stats

voidformat_odp_flow_stats(struct ds *ds, const struct odp_flow_stats *s){    ds_put_format(ds, "packets:%llu, bytes:%llu, used:",                  (unsigned long long int) s->n_packets,                  (unsigned long long int) s->n_bytes);    if (s->used_sec) {        long long int used = s->used_sec * 1000 + s->used_nsec / 1000000;        ds_put_format(ds, "%.3fs", (time_msec() - used) / 1000.0);    } else {        ds_put_format(ds, "never");    }}
开发者ID:InCNTRE,项目名称:OFTT,代码行数:13,


示例14: time_poll

/* Like poll(), except: * *      - On error, returns a negative error code (instead of setting errno). * *      - If interrupted by a signal, retries automatically until the original *        'timeout' expires.  (Because of this property, this function will *        never return -EINTR.) * *      - As a side effect, refreshes the current time (like time_refresh()). */inttime_poll(struct pollfd *pollfds, int n_pollfds, int timeout){    long long int start;    sigset_t oldsigs;    bool blocked;    int retval;    time_refresh();    start = time_msec();    blocked = false;    for (;;) {        int time_left;        if (timeout > 0) {            long long int elapsed = time_msec() - start;            time_left = timeout >= elapsed ? timeout - elapsed : 0;        } else {            time_left = timeout;        }        retval = poll(pollfds, n_pollfds, time_left);        if (retval < 0) {            retval = -errno;        }        if (retval != -EINTR) {            break;        }        if (!blocked && deadline == TIME_MIN) {            block_sigalrm(&oldsigs);            blocked = true;        }        time_refresh();    }    if (blocked) {        unblock_sigalrm(&oldsigs);    }    return retval;}
开发者ID:macauleycheng,项目名称:aos-dpctl,代码行数:49,


示例15: jsonrpc_session_wait

voidjsonrpc_session_wait(struct jsonrpc_session *s){    if (s->rpc) {        jsonrpc_wait(s->rpc);    } else if (s->stream) {        stream_run_wait(s->stream);        stream_connect_wait(s->stream);    }    if (s->pstream) {        pstream_wait(s->pstream);    }    reconnect_wait(s->reconnect, time_msec());}
开发者ID:rafaelfonte,项目名称:ovs,代码行数:14,


示例16: jsonrpc_session_connect

static voidjsonrpc_session_connect(struct jsonrpc_session *s){    const char *name = reconnect_get_name(s->reconnect);    int error;    jsonrpc_session_disconnect(s);    if (!reconnect_is_passive(s->reconnect)) {        error = jsonrpc_stream_open(name, &s->stream);        if (!error) {            reconnect_connecting(s->reconnect, time_msec());        }    } else {        error = s->pstream ? 0 : jsonrpc_pstream_open(name, &s->pstream);        if (!error) {            reconnect_listening(s->reconnect, time_msec());        }    }    if (error) {        reconnect_connect_failed(s->reconnect, time_msec(), error);    }    s->seqno++;}
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:24,


示例17: group_entry_create

struct group_entry *group_entry_create(struct datapath *dp, struct group_table *table, struct ofl_msg_group_mod *mod) {    struct group_entry *entry;    size_t i;    uint64_t now;    now = time_msec();    entry = xmalloc(sizeof(struct group_entry));    entry->dp          = dp;    entry->table       = table;    entry->desc = xmalloc(sizeof(struct ofl_group_desc_stats));    entry->desc->type =        mod->type;    entry->desc->group_id =    mod->group_id;    entry->desc->buckets_num = mod->buckets_num;    entry->desc->buckets     = mod->buckets;    entry->stats = xmalloc(sizeof(struct ofl_group_stats));    entry->stats->group_id      = mod->group_id;    entry->stats->ref_count     = 0;    entry->stats->packet_count  = 0;    entry->stats->byte_count    = 0;    entry->stats->counters_num  = mod->buckets_num;    entry->stats->counters      = (struct ofl_bucket_counter **) xmalloc(sizeof(struct ofl_bucket_counter *) * entry->stats->counters_num);    entry->stats->duration_sec  = 0;    entry->stats->duration_nsec = 0;    for (i=0; i<entry->stats->counters_num; i++) {        entry->stats->counters[i] = (struct ofl_bucket_counter *) xmalloc(sizeof(struct ofl_bucket_counter));        entry->stats->counters[i]->packet_count = 0;        entry->stats->counters[i]->byte_count = 0;    }    switch (mod->type) {        case (OFPGT_SELECT): {            init_select_group(entry, mod);            break;        }        default: {            entry->data = NULL;        }    }    list_init(&entry->flow_refs);    return entry;}
开发者ID:JanScheurich,项目名称:ofsoftswitch13,代码行数:48,


示例18: flow_entry_create

struct flow_entry *flow_entry_create(struct datapath *dp, struct flow_table *table, struct ofl_msg_flow_mod *mod) {    struct flow_entry *entry;    uint64_t now;    now = time_msec();    entry = xmalloc(sizeof(struct flow_entry));    entry->dp    = dp;    entry->table = table;    entry->stats = xmalloc(sizeof(struct ofl_flow_stats));    entry->stats->table_id         = mod->table_id;    entry->stats->duration_sec     = 0;    entry->stats->duration_nsec    = 0;    entry->stats->priority         = mod->priority;    entry->stats->importance = mod->importance;  //modified by dingwanfu.    entry->stats->idle_timeout     = mod->idle_timeout;    entry->stats->hard_timeout     = mod->hard_timeout;    entry->stats->cookie           = mod->cookie;    entry->stats->packet_count     = 0;    entry->stats->byte_count       = 0;    entry->stats->match            = mod->match;    entry->stats->instructions_num = mod->instructions_num;    entry->stats->instructions     = mod->instructions;    entry->match = mod->match; /* TODO: MOD MATCH? */    entry->created      = now;    entry->remove_at    = mod->hard_timeout == 0 ? 0                                  : now + mod->hard_timeout * 1000;    entry->last_used    = now;    entry->send_removed = ((mod->flags & OFPFF_SEND_FLOW_REM) != 0);    list_init(&entry->match_node);    list_init(&entry->idle_node);    list_init(&entry->hard_node);    list_init(&entry->group_refs);    init_group_refs(entry);    return entry;}
开发者ID:lindadunbar,项目名称:of11softswitch,代码行数:45,


示例19: rate_limit_start

voidrate_limit_start(struct secchan *secchan, const struct settings *s,                 struct switch_status *ss, struct rconn *remote){    struct rate_limiter *rl;    size_t i;    rl = xcalloc(1, sizeof *rl);    rl->s = s;    rl->remote_rconn = remote;    for (i = 0; i < ARRAY_SIZE(rl->queues); i++) {        queue_init(&rl->queues[i]);    }    rl->last_fill = time_msec();    rl->tokens = s->rate_limit * 100;    switch_status_register_category(ss, "rate-limit",                                    rate_limit_status_cb, rl);    add_hook(secchan, &rate_limit_hook_class, rl);}
开发者ID:CPqD,项目名称:of11softswitch,代码行数:19,


示例20: ct_thread_main

static void *ct_thread_main(void *aux_){    struct thread_aux *aux = aux_;    struct dp_packet_batch *pkt_batch;    ovs_be16 dl_type;    size_t i;    long long now = time_msec();    pkt_batch = prepare_packets(batch_size, change_conn, aux->tid, &dl_type);    ovs_barrier_block(&barrier);    for (i = 0; i < n_pkts; i += batch_size) {        conntrack_execute(ct, pkt_batch, dl_type, false, true, 0, NULL, NULL,                          0, 0, NULL, NULL, now);    }    ovs_barrier_block(&barrier);    destroy_packets(pkt_batch);    return NULL;}
开发者ID:openvswitch,项目名称:ovs,代码行数:20,


示例21: log_poll_interval

static voidlog_poll_interval(long long int last_wakeup){    long long int interval = time_msec() - last_wakeup;    if (interval >= 1000 && !is_warped(&monotonic_clock)) {        const struct rusage *last_rusage = get_recent_rusage();        struct rusage rusage;        getrusage(RUSAGE_SELF, &rusage);        VLOG_WARN("Unreasonably long %lldms poll interval"                  " (%lldms user, %lldms system)",                  interval,                  timeval_diff_msec(&rusage.ru_utime,                                    &last_rusage->ru_utime),                  timeval_diff_msec(&rusage.ru_stime,                                    &last_rusage->ru_stime));        if (rusage.ru_minflt > last_rusage->ru_minflt            || rusage.ru_majflt > last_rusage->ru_majflt) {            VLOG_WARN("faults: %ld minor, %ld major",                      rusage.ru_minflt - last_rusage->ru_minflt,                      rusage.ru_majflt - last_rusage->ru_majflt);        }        if (rusage.ru_inblock > last_rusage->ru_inblock            || rusage.ru_oublock > last_rusage->ru_oublock) {            VLOG_WARN("disk: %ld reads, %ld writes",                      rusage.ru_inblock - last_rusage->ru_inblock,                      rusage.ru_oublock - last_rusage->ru_oublock);        }        if (rusage.ru_nvcsw > last_rusage->ru_nvcsw            || rusage.ru_nivcsw > last_rusage->ru_nivcsw) {            VLOG_WARN("context switches: %ld voluntary, %ld involuntary",                      rusage.ru_nvcsw - last_rusage->ru_nvcsw,                      rusage.ru_nivcsw - last_rusage->ru_nivcsw);        }        coverage_log();    }}
开发者ID:PatrickGuo,项目名称:ovs-2.1.3,代码行数:38,


示例22: pcap_batch_execute_conntrack

static voidpcap_batch_execute_conntrack(struct conntrack *ct_,                             struct dp_packet_batch *pkt_batch){    struct dp_packet_batch new_batch;    ovs_be16 dl_type = htons(0);    long long now = time_msec();    dp_packet_batch_init(&new_batch);    /* pkt_batch contains packets with different 'dl_type'. We have to     * call conntrack_execute() on packets with the same 'dl_type'. */    struct dp_packet *packet;    DP_PACKET_BATCH_FOR_EACH (i, packet, pkt_batch) {        struct flow flow;        /* This also initializes the l3 and l4 pointers. */        flow_extract(packet, &flow);        if (dp_packet_batch_is_empty(&new_batch)) {            dl_type = flow.dl_type;        }        if (flow.dl_type != dl_type) {            conntrack_execute(ct_, &new_batch, dl_type, false, true, 0,                              NULL, NULL, 0, 0, NULL, NULL, now);            dp_packet_batch_init(&new_batch);        }        dp_packet_batch_add(&new_batch, packet);    }    if (!dp_packet_batch_is_empty(&new_batch)) {        conntrack_execute(ct_, &new_batch, dl_type, false, true, 0, NULL, NULL,                          0, 0, NULL, NULL, now);    }}
开发者ID:openvswitch,项目名称:ovs,代码行数:37,


示例23: refill_bucket

/* Add tokens to the bucket based on elapsed time. */voidrefill_bucket(struct meter_entry *entry){	size_t i;    for(i = 0; i < entry->config->meter_bands_num; i++) {    	long long int now = time_msec();        uint32_t rate;        uint32_t burst_size;        uint64_t tokens;        rate = entry->config->bands[i]->rate * 1000;        burst_size = entry->config->bands[i]->burst_size * 1000;        tokens =  (now - entry->stats->band_stats[i]->last_fill) *                rate  + entry->stats->band_stats[i]->tokens;        entry->stats->band_stats[i]->last_fill = now;        if (!(entry->config->flags & OFPMF_BURST)){            if(entry->config->flags & OFPMF_KBPS && tokens >= 1){		        entry->stats->band_stats[i]->tokens = MIN(tokens, rate);            }            else{                if(tokens >= 1000) {                    entry->stats->band_stats[i]->tokens = MIN(tokens, rate);                }            }        }        else {            if(entry->config->flags & OFPMF_KBPS && tokens >= 1 ){                    entry->stats->band_stats[i]->tokens = MIN(tokens,burst_size);            }            else {                if(tokens >= 1000) {                    entry->stats->band_stats[i]->tokens = MIN(tokens,burst_size);                }            }        }   	}}
开发者ID:NitsujY,项目名称:ofsoftswitch13,代码行数:38,


示例24: jsonrpc_session_recv

struct jsonrpc_msg *jsonrpc_session_recv(struct jsonrpc_session *s){    if (s->rpc) {        unsigned int received_bytes;        struct jsonrpc_msg *msg;        received_bytes = jsonrpc_get_received_bytes(s->rpc);        jsonrpc_recv(s->rpc, &msg);        if (received_bytes != jsonrpc_get_received_bytes(s->rpc)) {            /* Data was successfully received.             *             * Previously we only counted receiving a full message as activity,             * but with large messages or a slow connection that policy could             * time out the session mid-message. */            reconnect_activity(s->reconnect, time_msec());        }        if (msg) {            if (msg->type == JSONRPC_REQUEST && !strcmp(msg->method, "echo")) {                /* Echo request.  Send reply. */                struct jsonrpc_msg *reply;                reply = jsonrpc_create_reply(json_clone(msg->params), msg->id);                jsonrpc_session_send(s, reply);            } else if (msg->type == JSONRPC_REPLY                       && msg->id && msg->id->type == JSON_STRING                       && !strcmp(msg->id->u.string, "echo")) {                /* It's a reply to our echo request.  Suppress it. */            } else {                return msg;            }            jsonrpc_msg_destroy(msg);        }    }    return NULL;}
开发者ID:rafaelfonte,项目名称:ovs,代码行数:37,


示例25: flow_table_lookup

struct flow_entry *flow_table_lookup(struct flow_table *table, struct packet *pkt) {    struct flow_entry *entry;    table->stats->lookup_count++;    LIST_FOR_EACH(entry, struct flow_entry, match_node, &table->match_entries) {        struct ofl_match_header *m;        m = entry->match == NULL ? entry->stats->match : entry->match;        /* select appropriate handler, based on match type of flow entry. */        switch (m->type) {            case (OFPMT_OXM): {               if (packet_handle_std_match(pkt->handle_std,                                            (struct ofl_match *)m)) {                    entry->stats->byte_count += pkt->buffer->size;                    entry->stats->packet_count++;                    entry->last_used = time_msec();                    table->stats->matched_count++;                    return entry;                }                break;                break;            }            default: {                VLOG_WARN_RL(LOG_MODULE, &rl, "Trying to process flow entry with unknown match type (%u).", m->type);            }        }    }    return NULL;}
开发者ID:mmonaco,项目名称:of12softswitch,代码行数:36,


示例26: group_entry_update

voidgroup_entry_update(struct group_entry *entry){    entry->stats->duration_sec  =  (time_msec() - entry->created) / 1000;    entry->stats->duration_nsec = ((time_msec() - entry->created) % 1000) * 1000;}
开发者ID:JanScheurich,项目名称:ofsoftswitch13,代码行数:5,


示例27: main

int main(int argc, char **argv){  int verbose = 0;  int count = 5;  double rt, min, max, avg;  double a = 0.7, b = -0.88, c;  armas_x_dense_t A;  int ok, opt, i;  long k, N = 30000000;  int nproc = 1;  int avx_test = 0;  int fma_test = 0;  int testno = 0;  while ((opt = getopt(argc, argv, "c:vt:AF")) != -1) {    switch (opt) {    case 'v':      verbose = 1;      break;    case 't':      testno = atoi(optarg);      break;    case 'c':      count = atoi(optarg);      break;    case 'A':      avx_test = 1;      break;    case 'F':      fma_test = 1;      break;    default:      fprintf(stderr, "usage: perfgv [-c count -v] [size]/n");      exit(1);    }  }      if (optind < argc)    N = atol(argv[optind]);  long seed = (long)time(0);  srand48(seed);  // C = A*B  min = max = avg = 0.0;  for (i = 0; i < count; i++) {    flush();    if (fma_test) {      rt = time_msec();      c = test_gvcomp_fma(a, b, N);      rt = time_msec() - rt;    } else if (avx_test) {      rt = time_msec();      c = test_gvcomp_avx(a, b, N);      rt = time_msec() - rt;    } else {      rt = time_msec();      c = test_gvcomp(a, b, N);      rt = time_msec() - rt;    }          if (i == 0) {      min = max = avg = rt;    } else {      if (rt < min)	min = rt;      if (rt > max)	max = rt;      avg += (rt - avg)/(i+1);    }    if (verbose)      printf("%2d: %.4f, %.4f, %.4f msec/n", i, min, avg, max);  }  int64_t nops = 7*(int64_t)N;  if (testno == 0) {    nops = N;    nops *= 7;  } else if (testno == 2) {    nops = N*N;    nops *= 7;  }  printf("N: %4ld, %8.4f, %8.4f, %8.4f Gflops/n", N,         gflops(max, nops), gflops(avg, nops), gflops(min, nops));  printf("c=%.f/n", c);  return 0;}
开发者ID:hrautila,项目名称:armas,代码行数:90,


示例28: jsonrpc_session_run

voidjsonrpc_session_run(struct jsonrpc_session *s){    if (s->pstream) {        struct stream *stream;        int error;        error = pstream_accept(s->pstream, &stream);        if (!error) {            if (s->rpc || s->stream) {                VLOG_INFO_RL(&rl,                             "%s: new connection replacing active connection",                             reconnect_get_name(s->reconnect));                jsonrpc_session_disconnect(s);            }            reconnect_connected(s->reconnect, time_msec());            s->rpc = jsonrpc_open(stream);        } else if (error != EAGAIN) {            reconnect_listen_error(s->reconnect, time_msec(), error);            pstream_close(s->pstream);            s->pstream = NULL;        }    }    if (s->rpc) {        size_t backlog;        int error;        backlog = jsonrpc_get_backlog(s->rpc);        jsonrpc_run(s->rpc);        if (jsonrpc_get_backlog(s->rpc) < backlog) {            /* Data previously caught in a queue was successfully sent (or             * there's an error, which we'll catch below.)             *             * We don't count data that is successfully sent immediately as             * activity, because there's a lot of queuing downstream from us,             * which means that we can push a lot of data into a connection             * that has stalled and won't ever recover.             */            reconnect_activity(s->reconnect, time_msec());        }        error = jsonrpc_get_status(s->rpc);        if (error) {            reconnect_disconnected(s->reconnect, time_msec(), error);            jsonrpc_session_disconnect(s);            s->last_error = error;        }    } else if (s->stream) {        int error;        stream_run(s->stream);        error = stream_connect(s->stream);        if (!error) {            reconnect_connected(s->reconnect, time_msec());            s->rpc = jsonrpc_open(s->stream);            s->stream = NULL;        } else if (error != EAGAIN) {            reconnect_connect_failed(s->reconnect, time_msec(), error);            stream_close(s->stream);            s->stream = NULL;            s->last_error = error;        }    }    switch (reconnect_run(s->reconnect, time_msec())) {    case RECONNECT_CONNECT:        jsonrpc_session_connect(s);        break;    case RECONNECT_DISCONNECT:        reconnect_disconnected(s->reconnect, time_msec(), 0);        jsonrpc_session_disconnect(s);        break;    case RECONNECT_PROBE:        if (s->rpc) {            struct json *params;            struct jsonrpc_msg *request;            params = json_array_create_empty();            request = jsonrpc_create_request("echo", params, NULL);            json_destroy(request->id);            request->id = json_string_create("echo");            jsonrpc_send(s->rpc, request);        }        break;    }}
开发者ID:rafaelfonte,项目名称:ovs,代码行数:89,


示例29: jsonrpc_session_force_reconnect

/* Forces 's' to drop its connection (if any) and reconnect. */voidjsonrpc_session_force_reconnect(struct jsonrpc_session *s){    reconnect_force_reconnect(s->reconnect, time_msec());}
开发者ID:rafaelfonte,项目名称:ovs,代码行数:6,


示例30: jsonrpc_session_get_reconnect_stats

/* Populates 'stats' with statistics from 's'. */voidjsonrpc_session_get_reconnect_stats(const struct jsonrpc_session *s,                                    struct reconnect_stats *stats){    reconnect_get_stats(s->reconnect, time_msec(), stats);}
开发者ID:rafaelfonte,项目名称:ovs,代码行数:7,



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


C++ time_now函数代码示例
C++ time_is_before_jiffies函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。