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

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

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

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

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

示例1: stats_prefix_record_removal

/* * Records a "removal" of a key. */void stats_prefix_record_removal(const char *key, const size_t nkey, size_t bytes, rel_time_t time, long flags) {    PREFIX_STATS *pfs;    GLOBAL_STATS_LOCK();    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        rel_time_t now = current_time;        if (flags & UNLINK_IS_EVICT) {            pfs->num_evicts ++;        } else if (flags & UNLINK_IS_EXPIRED) {            pfs->num_expires ++;        }        if (now != pfs->last_update) {            /*             * increment total byte-seconds to reflect time elapsed since last             * update.             */            pfs->total_byte_seconds += pfs->num_bytes * (now - pfs->last_update);            pfs->last_update = now;        }        /* remove the byte count and the lifetime of the object that we're         * booting out. */        pfs->num_bytes -= bytes;        /* increment item count. */        pfs->num_items --;    }    GLOBAL_STATS_UNLOCK();}
开发者ID:AristidesIoannou,项目名称:facebook-memcached-old,代码行数:36,


示例2: stats_prefix_record_byte_total_change

/* * Records the change in byte total due to a "set" of a key. */void stats_prefix_record_byte_total_change(const char *key, const size_t nkey, long bytes, int prefix_stats_flags) {    PREFIX_STATS *pfs;    GLOBAL_STATS_LOCK();    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        rel_time_t now = current_time;        if (now != pfs->last_update) {            /*             * increment total byte-seconds to reflect time elapsed since last             * update.             */            pfs->total_byte_seconds += pfs->num_bytes * (now - pfs->last_update);            pfs->last_update = now;        }        /* add the byte count of the object that we're booting out. */        pfs->num_bytes += bytes;        if (prefix_stats_flags & PREFIX_INCR_ITEM_COUNT) {            /* increment item count. */            pfs->num_items ++;        }        if (prefix_stats_flags & PREFIX_IS_OVERWRITE) {            /* increment overwrite count. */            pfs->num_overwrites ++;        }    }    GLOBAL_STATS_UNLOCK();}
开发者ID:AristidesIoannou,项目名称:facebook-memcached-old,代码行数:35,


示例3: stats_prefix_record_setattr

void stats_prefix_record_setattr(const char *key, const size_t nkey) {    PREFIX_STATS *pfs;    STATS_LOCK();    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        pfs->num_setattrs++;    }    STATS_UNLOCK();}
开发者ID:ngleader,项目名称:arcus-memcached,代码行数:10,


示例4: stats_prefix_record_set

void stats_prefix_record_set(const char *key, const size_t nkey) {//记录某key被设置的次数    PREFIX_STATS *pfs;    STATS_LOCK();    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        pfs->num_sets++; //写操作增加一次    }    STATS_UNLOCK();}
开发者ID:danial-cao,项目名称:Reading-and-comprehense-memcached-1.4.22,代码行数:10,


示例5: stats_prefix_record_delete

/* * Records a "delete" of a key. */void stats_prefix_record_delete(const char *key, const size_t nkey) {    PREFIX_STATS *pfs;    GLOBAL_STATS_LOCK();    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        pfs->num_deletes++;    }    GLOBAL_STATS_UNLOCK();}
开发者ID:AristidesIoannou,项目名称:facebook-memcached-old,代码行数:13,


示例6: test_prefix_record_set

static void test_prefix_record_set() {    PREFIX_STATS *pfs;    stats_prefix_record_set("abc:123");    pfs = stats_prefix_find("abc:123");    test_equals_ull("get count after set #1", 0, pfs->num_gets);    test_equals_ull("hit count after set #1", 0, pfs->num_hits);    test_equals_ull("delete count after set #1", 0, pfs->num_deletes);    test_equals_ull("set count after set #1", 1, pfs->num_sets);    stats_prefix_record_delete("def:");    test_equals_ull("set count after set #2", 1, pfs->num_sets);}
开发者ID:ngleader,项目名称:arcus-memcached,代码行数:12,


示例7: stats_prefix_record_set

/* * Records a "set" of a key. */void stats_prefix_record_set(const char *key, const size_t nkey) {    PREFIX_STATS *pfs;    // [branch 002] Replaced STATS_LOCK with relaxed transaction    // [branch 012] With oncommit, this becomes atomic    __transaction_atomic {    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        pfs->num_sets++;    }    }}
开发者ID:Ikulagin,项目名称:transmem,代码行数:15,


示例8: stats_prefix_record_set

/* * Records a "set" of a key. */void stats_prefix_record_set(const char *key, const size_t nkey) {    PREFIX_STATS *pfs;    GLOBAL_STATS_LOCK();    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        /* item count cannot be incremented here because the set/add/replace may         * yet fail. */        pfs->num_sets++;    }    GLOBAL_STATS_UNLOCK();}
开发者ID:AristidesIoannou,项目名称:facebook-memcached-old,代码行数:15,


示例9: stats_prefix_record_bop_gbp

void stats_prefix_record_bop_gbp(const char *key, const size_t nkey, const bool is_hit) {    PREFIX_STATS *pfs;    STATS_LOCK();    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        pfs->num_bop_gbps++;        if (is_hit) {            pfs->num_bop_gbp_hits++;        }    }    STATS_UNLOCK();}
开发者ID:ngleader,项目名称:arcus-memcached,代码行数:13,


示例10: stats_prefix_record_get

/* * Records a "get" of a key. */void stats_prefix_record_get(const char *key, const size_t nkey, const size_t nbytes, const bool is_hit) {    PREFIX_STATS *pfs;    GLOBAL_STATS_LOCK();    pfs = stats_prefix_find(key, nkey);    if (NULL != pfs) {        pfs->num_gets++;        if (is_hit) {            pfs->num_hits++;            pfs->bytes_txed += nbytes;        }    }    GLOBAL_STATS_UNLOCK();}
开发者ID:AristidesIoannou,项目名称:facebook-memcached-old,代码行数:17,


示例11: test_prefix_record_get

static void test_prefix_record_get() {    PREFIX_STATS *pfs;    stats_prefix_record_get("abc:123", 0);    pfs = stats_prefix_find("abc:123");    test_equals_ull("get count after get #1", 1, pfs->num_gets);    test_equals_ull("hit count after get #1", 0, pfs->num_hits);    stats_prefix_record_get("abc:456", 0);    test_equals_ull("get count after get #2", 2, pfs->num_gets);    test_equals_ull("hit count after get #2", 0, pfs->num_hits);    stats_prefix_record_get("abc:456", 1);    test_equals_ull("get count after get #3", 3, pfs->num_gets);    test_equals_ull("hit count after get #3", 1, pfs->num_hits);    stats_prefix_record_get("def:", 1);    test_equals_ull("get count after get #4", 3, pfs->num_gets);    test_equals_ull("hit count after get #4", 1, pfs->num_hits);}
开发者ID:ngleader,项目名称:arcus-memcached,代码行数:17,


示例12: test_prefix_find

static void test_prefix_find() {    PREFIX_STATS *pfs1, *pfs2;    pfs1 = stats_prefix_find("abc");    test_notnull_ptr("initial prefix find", pfs1);    test_equals_ull("request counts", 0ULL,        pfs1->num_gets + pfs1->num_sets + pfs1->num_deletes + pfs1->num_hits);    pfs2 = stats_prefix_find("abc");    test_equals_ptr("find of same prefix", pfs1, pfs2);    pfs2 = stats_prefix_find("abc:");    test_equals_ptr("find of same prefix, ignoring delimiter", pfs1, pfs2);    pfs2 = stats_prefix_find("abc:d");    test_equals_ptr("find of same prefix, ignoring extra chars", pfs1, pfs2);    pfs2 = stats_prefix_find("xyz123");    test_notequals_ptr("find of different prefix", pfs1, pfs2);    pfs2 = stats_prefix_find("ab:");    test_notequals_ptr("find of shorter prefix", pfs1, pfs2);}
开发者ID:ngleader,项目名称:arcus-memcached,代码行数:18,



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


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