• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ stats_init函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main(int argc, char** argv){    
    /*
        主线程主体流程:
        conn_init;
        thread_init;
        还得有一个
        stat_init
        stats的结构是用来记录当前的状态的,stats是一个静态变量
    
        server_socket 请求,分发
        注册事件loop
    */
    int retval;
    main_base = event_init();
    FILE *portnumber_file = NULL;
    portnumber_file = fopen("/tmp/portnumber.file", "a");

    stats_init();
    conn_init();
    thread_init(NUM_OF_THREADS);

    server_socket("127.0.0.1", SERVER_PORT, tcp_transport, portnumber_file);

    if (event_base_loop(main_base, 0) != 0) {
	printf("event_base_loop error");
        retval = EXIT_FAILURE;
    }
    return retval;

    exit(0);

}
开发者ID:wadee,项目名称:go_proj,代码行数:32,代码来源:threadsay.c


示例2: app_startup

void
app_startup(void)
{
  msg_init(FALSE);
  iv_set_fatal_msg_handler(app_fatal);
  iv_init();
  g_thread_init(NULL);
  crypto_init();
  hostname_global_init();
  dns_caching_global_init();
  dns_caching_thread_init();
  afinter_global_init();
  child_manager_init();
  alarm_init();
  stats_init();
  tzset();
  log_msg_global_init();
  log_tags_global_init();
  log_source_global_init();
  log_template_global_init();
  value_pairs_global_init();
  service_management_init();
  scratch_buffers_allocator_init();
  main_loop_thread_resource_init();
  nondumpable_setlogger(nondumpable_allocator_logger);
  secret_storage_init();
  transport_factory_id_global_init();
}
开发者ID:jszigetvari,项目名称:syslog-ng,代码行数:28,代码来源:apphook.c


示例3: main

/**
 * main
 *
 * The main task for the project. This function initializes the packages, calls
 * init_tasks to initialize additional tasks (and possibly other objects),
 * then starts serving events from default event queue.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{
    int rc;

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif

    sysinit();

    cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
    log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL);

    stats_init(STATS_HDR(g_stats_gpio_toggle),
               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
               STATS_NAME_INIT_PARMS(gpio_stats));

    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));

    conf_load();

    reboot_start(hal_reset_cause());

    init_tasks();

    while (1) {
        os_eventq_run(os_eventq_dflt_get());
    }
    /* Never exit */
    return rc;
}
开发者ID:vrahane,项目名称:incubator-mynewt-core,代码行数:41,代码来源:main.c


示例4: test_stats

void
test_stats()
{
  GString *reply = NULL;
  GString *command = g_string_sized_new(128);
  StatsCounterItem *counter = NULL;
  gchar **stats_result;

  stats_init();
  stats_lock();
  stats_register_counter(0, SCS_CENTER, "id", "received", SC_TYPE_PROCESSED, &counter);
  stats_unlock();

  g_string_assign(command,"STATS");

  reply = control_connection_send_stats(command);
  stats_result = g_strsplit(reply->str, "\n", 2);
  assert_string(stats_result[0], "SourceName;SourceId;SourceInstance;State;Type;Number",
                "Bad reply");
  g_strfreev(stats_result);
  g_string_free(reply, TRUE);

  g_string_free(command, TRUE);
  stats_destroy();
  return;
}
开发者ID:Achint08,项目名称:syslog-ng,代码行数:26,代码来源:test_control_cmds.c


示例5: main

/**
 * main
 *
 * The main function for the project. This function initializes the os, calls
 * init_tasks to initialize tasks (and possibly other objects), then starts the
 * OS. We should not return from os start.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{
    int rc;

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif

    sysinit();

    cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
    log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL);

    stats_init(STATS_HDR(g_stats_gpio_toggle),
               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
               STATS_NAME_INIT_PARMS(gpio_stats));

    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));

    conf_load();

    log_reboot(HARD_REBOOT);

    init_tasks();

    os_start();

    /* os start should never return. If it does, this should be an error */
    assert(0);

    return rc;
}
开发者ID:apache,项目名称:incubator-mynewt-core,代码行数:42,代码来源:main.c


示例6: test_action_execute_drop

/* Try to execute action with the drop action, which should succeed */
static void
test_action_execute_drop(int argc, char *argv[])
{
	struct rte_mbuf buf_free;
	struct rte_mbuf buf_drop;
	struct action action_multiple[MAX_ACTIONS] = {0};
	struct action action_drop[MAX_ACTIONS] = {0};

	stats_init();
	stats_vswitch_clear();

	/* TODO: Break this into multiple tests? */
	/* check that mbuf is freed on drop */
	assert(memcmp(&buf_free, &buf_drop, sizeof(buf_drop)) != 0);
	buf_drop.pkt.next = NULL; /* Required for rte_pktmbuf_free */
	memcpy(&buf_free, &buf_drop, sizeof(buf_drop));
	assert(memcmp(&buf_free, &buf_drop, sizeof(buf_drop)) == 0);
	action_drop_build(&action_drop[0]);
	action_null_build(&action_drop[1]);
	action_execute(action_drop, &buf_free);
	assert(memcmp(&buf_free, &buf_drop, sizeof(buf_drop)) != 0);
	/* check that vswitch rx drop stats are increased */
	stats_vswitch_clear();
	assert(stats_vswitch_rx_drop_get() == 0);
	action_drop_build(&action_drop[0]);
	action_null_build(&action_drop[1]);
	action_execute(action_drop, &buf_drop);
	assert(stats_vswitch_rx_drop_get() == 1);
}
开发者ID:Grace-Liu,项目名称:dpdk-ovs,代码行数:30,代码来源:test-datapath-dpdk.c


示例7: race_set

void race_set(struct race_t* pRace, const char* name,
    unsigned str, unsigned dex, unsigned con, unsigned intel, unsigned wis)
{
    pRace->name[0] = '\0';
    strcat(pRace->name, name);
    stats_init(&pRace->stats, str, dex, con, intel, wis);
}
开发者ID:metiscus,项目名称:meow,代码行数:7,代码来源:character.c


示例8: main

int main(int argc, char **argv) {

	char *config_xml;

	if (argc != 2) {
		printf("Usage: %s config.xml \n", argv[0]);
		return (EXIT_SUCCESS);
	}


	// GET Ctrl+C signal;
	signal(SIGINT, exit_proc);

	/** Read configure file */

	config_xml = argv[1];
	parse_doc(config_xml);


	/** Initialize NFQUEUE forwarding process, logging files e.t.c */

	if(!nfqp_init() || !glb_init() || !stats_init() /* MYSQL , */){
		exit_proc();
	}




	nfqp_analyzer_function();



	return(EXIT_SUCCESS);

}
开发者ID:SolitaryX88,项目名称:FlowEinziehen,代码行数:35,代码来源:packet_analyzer.c


示例9: tcs34725_init

/**
 * Expects to be called back through os_dev_create().
 *
 * @param The device object associated with this color sensor
 * @param Argument passed to OS device init, unused
 *
 * @return 0 on success, non-zero error on failure.
 */
int
tcs34725_init(struct os_dev *dev, void *arg)
{
    struct tcs34725 *tcs34725;
    struct sensor *sensor;
    int rc;

    if (!arg || !dev) {
        rc = SYS_ENODEV;
        goto err;
    }

    tcs34725 = (struct tcs34725 *) dev;

    tcs34725->cfg.mask = SENSOR_TYPE_ALL;

    sensor = &tcs34725->sensor;

    /* Initialise the stats entry */
    rc = stats_init(
        STATS_HDR(g_tcs34725stats),
        STATS_SIZE_INIT_PARMS(g_tcs34725stats, STATS_SIZE_32),
        STATS_NAME_INIT_PARMS(tcs34725_stat_section));
    SYSINIT_PANIC_ASSERT(rc == 0);
    /* Register the entry with the stats registry */
    rc = stats_register("tcs34725", STATS_HDR(g_tcs34725stats));
    SYSINIT_PANIC_ASSERT(rc == 0);

    rc = sensor_init(sensor, dev);
    if (rc != 0) {
        goto err;
    }

    /* Add the color sensor driver */
    rc = sensor_set_driver(sensor, SENSOR_TYPE_COLOR,
                           (struct sensor_driver *) &g_tcs34725_sensor_driver);
    if (rc != 0) {
        goto err;
    }

    /* Set the interface */
    rc = sensor_set_interface(sensor, arg);
    if (rc) {
        goto err;
    }

    rc = sensor_mgr_register(sensor);
    if (rc != 0) {
        goto err;
    }

    rc = sensor_set_type_mask(sensor, tcs34725->cfg.mask);
    if (rc) {
        goto err;
    }

    return (0);
err:
    return (rc);
}
开发者ID:ccollins476ad,项目名称:incubator-mynewt-core,代码行数:68,代码来源:tcs34725.c


示例10: while

// initialisation
void DataFlash_MAVLink::Init(const struct LogStructure *structure, uint8_t num_types)
{
    DataFlash_Backend::Init(structure, num_types);

    _blocks = NULL;
    while (_blockcount >= 8) { // 8 is a *magic* number
        _blocks = (struct dm_block *) malloc(_blockcount * sizeof(_blocks[0]));
        if (_blocks != NULL) {
            break;
        }
        _blockcount /= 2;
    }

    if (_blocks == NULL) {
        return;
    }

    free_all_blocks();
    stats_init();

    _initialised = true;
    _logging_started = true; // in actual fact, we throw away
                             // everything until a client connects.
                             // This stops calls to start_new_log from
                             // the vehicles
}
开发者ID:3drobotics,项目名称:ardupilot-solo,代码行数:27,代码来源:DataFlash_MAVLink.cpp


示例11: while

// initialisation
void DataFlash_MAVLink::Init()
{
    semaphore = hal.util->new_semaphore();
    if (semaphore == nullptr) {
        AP_HAL::panic("Failed to create DataFlash_MAVLink semaphore");
        return;
    }

    DataFlash_Backend::Init();

    _blocks = nullptr;
    while (_blockcount >= 8) { // 8 is a *magic* number
        _blocks = (struct dm_block *) malloc(_blockcount * sizeof(_blocks[0]));
        if (_blocks != nullptr) {
            break;
        }
        _blockcount /= 2;
    }

    if (_blocks == nullptr) {
        return;
    }

    free_all_blocks();
    stats_init();

    _initialised = true;
    _logging_started = true; // in actual fact, we throw away
                             // everything until a client connects.
                             // This stops calls to start_new_log from
                             // the vehicles
}
开发者ID:Hurisa,项目名称:ardupilot,代码行数:33,代码来源:DataFlash_MAVLink.cpp


示例12: test_stats_vport_xxx_clear

/* Try to clear stats for all vport counters, which should succeed */
static void
test_stats_vport_xxx_clear(int argc, char *argv[])
{
	int vportid = 0;

	stats_init();
	stats_vport_clear_all();

	/* increment stats so there's something to clear */
	for (vportid = 0; vportid < MAX_VPORTS; vportid++) {
		stats_vport_rx_increment(vportid, 23);
		stats_vport_rx_drop_increment(vportid, 23);
		stats_vport_tx_increment(vportid, 23);
		stats_vport_tx_drop_increment(vportid, 23);
		stats_vport_overrun_increment(vportid, 23);
		stats_vport_rx_increment(vportid, 19);
		stats_vport_rx_drop_increment(vportid, 19);
		stats_vport_tx_increment(vportid, 19);
		stats_vport_tx_drop_increment(vportid, 19);
		stats_vport_overrun_increment(vportid, 19);
	}

	for (vportid = 0; vportid < MAX_VPORTS; vportid++) {
		stats_vport_clear(vportid);
		assert(stats_vport_rx_get(vportid) == 0);
		assert(stats_vport_rx_drop_get(vportid) == 0);
		assert(stats_vport_tx_get(vportid) == 0);
		assert(stats_vport_tx_drop_get(vportid) == 0);
		assert(stats_vport_overrun_get(vportid) == 0);
	}
}
开发者ID:Grace-Liu,项目名称:dpdk-ovs,代码行数:32,代码来源:test-datapath-dpdk.c


示例13: test_reset_stats

void
test_reset_stats()
{
  GString *reply = NULL;
  GString *command = g_string_sized_new(128);
  StatsCounterItem *counter = NULL;

  stats_init();
  stats_lock();
  stats_register_counter(0, SCS_CENTER, "id", "received", SC_TYPE_PROCESSED, &counter);
  stats_counter_set(counter, 666);
  stats_unlock();

  g_string_assign(command, "RESET_STATS");
  reply = control_connection_reset_stats(command);
  assert_string(reply->str, "The statistics of syslog-ng have been reset to 0.", "Bad reply");
  g_string_free(reply, TRUE);

  g_string_assign(command, "STATS");
  reply = control_connection_send_stats(command);
  assert_string(reply->str, "SourceName;SourceId;SourceInstance;State;Type;Number\ncenter;id;received;a;processed;0\n", "Bad reply");
  g_string_free(reply, TRUE);

  stats_destroy();
  g_string_free(command, TRUE);
  return;
}
开发者ID:Achint08,项目名称:syslog-ng,代码行数:27,代码来源:test_control_cmds.c


示例14: i1480u_init

static inline
void i1480u_init(struct i1480u *i1480u)
{
	/* nothing so far... doesn't it suck? */
	spin_lock_init(&i1480u->lock);
	INIT_LIST_HEAD(&i1480u->tx_list);
	spin_lock_init(&i1480u->tx_list_lock);
	wlp_options_init(&i1480u->options);
	edc_init(&i1480u->tx_errors);
	edc_init(&i1480u->rx_errors);
#ifdef i1480u_FLOW_CONTROL
	edc_init(&i1480u->notif_edc);
#endif
	stats_init(&i1480u->lqe_stats);
	stats_init(&i1480u->rssi_stats);
	wlp_init(&i1480u->wlp);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:17,代码来源:lc.c


示例15: setup

static void
setup(void)
{
  g_thread_init(NULL);
  stats_init();
  scratch_buffers_global_init();
  scratch_buffers_allocator_init();
}
开发者ID:jszigetvari,项目名称:syslog-ng,代码行数:8,代码来源:test_scratch_buffers.c


示例16: lwip_init

/**
 * Perform Sanity check of user-configurable values, and initialize all modules.
 */
void
lwip_init(void)
{
  /* Sanity check user-configurable values */
  lwip_sanity_check();

  /* Modules initialization */
  stats_init();
#if !NO_SYS
  sys_init();
#endif /* !NO_SYS */
  mem_init();
  memp_init();
  pbuf_init();
  netif_init();
#if LWIP_SOCKET
  lwip_socket_init();
#endif /* LWIP_SOCKET */
  ip_init();
#if LWIP_ARP
  etharp_init();
#endif /* LWIP_ARP */
#if LWIP_RAW
  raw_init();
#endif /* LWIP_RAW */
#if LWIP_UDP
  udp_init();
#endif /* LWIP_UDP */
#if LWIP_TCP
  tcp_init();
#endif /* LWIP_TCP */
#if LWIP_SNMP
  snmp_init();
#endif /* LWIP_SNMP */
#if LWIP_AUTOIP
  autoip_init();
#endif /* LWIP_AUTOIP */
#if LWIP_IGMP
  igmp_init();
#endif /* LWIP_IGMP */
#if LWIP_DNS
  dns_init();
#endif /* LWIP_DNS */

#if LWIP_TIMERS
  sys_timeouts_init();
#endif /* LWIP_TIMERS */

#if !NO_SYS
  /* in the Xilinx lwIP 1.2.0 port, lwip_init() was added as a convenience utility function
     to initialize all the lwIP layers. lwIP 1.3.0 introduced lwip_init() in the base lwIP
     itself. However a user cannot use lwip_init() regardless of whether it is raw or socket
     modes. The following call to lwip_sock_init() is made to make sure that lwIP is properly
     initialized in both raw & socket modes with just a call to lwip_init().
   */
  lwip_sock_init();
#endif
}
开发者ID:GiannisRambo,项目名称:lwip,代码行数:61,代码来源:init.c


示例17: lwip_init

/**
 * Perform Sanity check of user-configurable values, and initialize all modules.
 */
void
lwip_init(void)
{
  /*++ Changed by Espressif ++*/
  MEMP_NUM_TCP_PCB = 5;
  TCP_WND = (4 * TCP_MSS);
  TCP_MAXRTX = 3;
  TCP_SYNMAXRTX = 6;
  /*--                      --*/


  /* Modules initialization */
  stats_init();
#if !NO_SYS
  sys_init();
#endif /* !NO_SYS */
/*++ Changed by Espressif ++*/
#if 0
  mem_init(&_bss_end);
#endif
/*--                      --*/
  memp_init();
  pbuf_init();
  netif_init();
#if LWIP_SOCKET
  lwip_socket_init();
#endif /* LWIP_SOCKET */
  ip_init();
#if LWIP_ARP
  etharp_init();
#endif /* LWIP_ARP */
#if LWIP_RAW
  raw_init();
#endif /* LWIP_RAW */
#if LWIP_UDP
  udp_init();
#endif /* LWIP_UDP */
#if LWIP_TCP
  tcp_init();
#endif /* LWIP_TCP */
#if LWIP_SNMP
  snmp_init();
#endif /* LWIP_SNMP */
#if LWIP_AUTOIP
  autoip_init();
#endif /* LWIP_AUTOIP */
#if LWIP_IGMP
  igmp_init();
#endif /* LWIP_IGMP */
#if LWIP_DNS
  dns_init();
#endif /* LWIP_DNS */

#if LWIP_TIMERS
  sys_timeouts_init();
#endif /* LWIP_TIMERS */
}
开发者ID:sdelavega,项目名称:smart.js,代码行数:60,代码来源:init.c


示例18: bno055_init

/**
 * Expects to be called back through os_dev_create().
 *
 * @param The device object associated with this accellerometer
 * @param Argument passed to OS device init, unused
 *
 * @return 0 on success, non-zero error on failure.
 */
int
bno055_init(struct os_dev *dev, void *arg)
{
    struct bno055 *bno055;
    struct sensor *sensor;
    int rc;

    bno055 = (struct bno055 *) dev;

    rc = bno055_default_cfg(&bno055->cfg);
    if (rc) {
        goto err;
    }

#if MYNEWT_VAL(BNO055_LOG)
    log_register("bno055", &_log, &log_console_handler, NULL, LOG_SYSLEVEL);
#endif

    sensor = &bno055->sensor;

#if MYNEWT_VAL(BNO055_STATS)
    /* Initialise the stats entry */
    rc = stats_init(
        STATS_HDR(g_bno055stats),
        STATS_SIZE_INIT_PARMS(g_bno055stats, STATS_SIZE_32),
        STATS_NAME_INIT_PARMS(bno055_stat_section));
    SYSINIT_PANIC_ASSERT(rc == 0);
    /* Register the entry with the stats registry */
    rc = stats_register("bno055", STATS_HDR(g_bno055stats));
    SYSINIT_PANIC_ASSERT(rc == 0);
#endif

    rc = sensor_init(sensor, dev);
    if (rc != 0) {
        goto err;
    }

    /* Add the accelerometer/magnetometer driver */
    rc = sensor_set_driver(sensor, SENSOR_TYPE_ACCELEROMETER         |
            SENSOR_TYPE_MAGNETIC_FIELD | SENSOR_TYPE_GYROSCOPE       |
            SENSOR_TYPE_TEMPERATURE    | SENSOR_TYPE_ROTATION_VECTOR |
            SENSOR_TYPE_GRAVITY        | SENSOR_TYPE_LINEAR_ACCEL    |
            SENSOR_TYPE_EULER, (struct sensor_driver *) &g_bno055_sensor_driver);
    if (rc != 0) {
        goto err;
    }

    rc = sensor_mgr_register(sensor);
    if (rc != 0) {
        goto err;
    }

    return (0);
err:
    return (rc);
}
开发者ID:a3zzat,项目名称:incubator-mynewt-core,代码行数:64,代码来源:bno055.c


示例19: Java_com_android_spinningcube_SpinningCubeLib_init

JNIEXPORT void JNICALL Java_com_android_spinningcube_SpinningCubeLib_init(JNIEnv * env, jobject obj,  jint width, jint height, jstring vShader, jstring fShader)
{
    if(!gVertexShader && !gFragmentShader) {
	gVertexShader = env->GetStringUTFChars(vShader, 0);
	gFragmentShader = env->GetStringUTFChars(fShader, 0);
    }
    setupGraphics(width, height);
    stats_init(&stats);

}
开发者ID:a-s-j,项目名称:spinningcube,代码行数:10,代码来源:gl_code.cpp


示例20: init_stats

static void init_stats(system_data_t *sysdata)
{
	assert(sysdata);
	assert(sysdata->stats == NULL);
	
	sysdata->stats = (stats_t *) malloc(sizeof(stats_t));
	stats_init(sysdata->stats);
	sysdata->stats->sysdata = sysdata;
	stats_start(sysdata->stats);
}
开发者ID:hyper,项目名称:rqd,代码行数:10,代码来源:rqd.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ strv_length函数代码示例发布时间:2022-05-31
下一篇:
C++ sqlite3_result_blob函数代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap