int main(int argc, char **argv) { void *data; mlog_init(); TopSaxParser parser1; // Debugging if argc > 1 if(argc > 1) { mlog_registerColorFormatter((color_formatter_func_t)sprintf_color); mlog_addOutputFile((char *)"/dev/tty", 1); mlog_setModuleLevel((char *)"top", LOG_DEBUG); mlog_setModuleLevel((char *)"topparser", LOG_DEBUG); } // init im_init(&data, NULL); // sleep sleep(1); while(1) { // update im_update(data); int i = 16000; im_get(data, buff, &i); //system("clear"); //printf("%s", buff); //printf("\n"); processVecT v; TopSaxParser parser; parser.parse(std::string(buff), v); std::cout << "================= Top Processes: " << v.size() << " ======================" << std::endl; for(std::vector<ProcessStatusInfo>::iterator iter = v.begin() ; iter != v.end() ; iter++) { ProcessStatusInfo *pi = &(*iter); std::cout << "XML:" << std::endl << pi->getProcessXML(); } sleep(3); } // free im_free(&data); free(buff); return 0; }
int main(int argc, char **argv) { void *data; mlog_init(); // MeminfoSaxParser parser1; // Debugging if argc > 1 if(argc > 1) { mlog_registerColorFormatter((color_formatter_func_t)sprintf_color); mlog_addOutputFile((char *)"/dev/tty", 1); mlog_setModuleLevel((char *)"meminfo", LOG_DEBUG); mlog_setModuleLevel((char *)"meminfoparser", LOG_DEBUG); } // init im_init(&data, NULL); // sleep sleep(1); while(1) { // update im_update(data); int i = 8192; im_get(data, buff, &i); //system("clear"); printf("%s", buff); printf("\n"); MeminfoSaxParser parser; Meminfo mi; parser.parse(std::string(buff), mi); std::cout << mi.get_xml(); std::cout << "====================================================" << std::endl << std::endl; sleep(1); } // free im_free(&data); free(buff); return 0; }
/**@brief Application main function. */ int main(void) { uint32_t err_code; connected = false; mlog_init(); timers_init(); gpiote_init(); buttons_init(); step_counter_init(); motor_init(); led1_init(); mlog_str("Starting MAIN...\r\n"); bond_manager_init(); ble_stack_init(); radio_notification_init(); // Initialize Bluetooth Stack parameters gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Actually start advertising //advertising_start(); app_button_enable(); // Enter main loop for (;;) { // Switch to a low power state until an event is available for the application err_code = sd_app_event_wait(); APP_ERROR_CHECK(err_code); } }
main(int argc, char *argv[]) { int rval = -1, nsess = 8, nmedia = 2, nstreams = 3, level = 0; int cc = 0; extern char *optarg; extern int optind; char *uuid = NULL; char *label = NULL; hi op = BULL; progname = argv[0]; sesfile = "sessions"; ASSERT( argc > 1 ); mlog_init( argc, argv ); if (! inv_DEBUG_print(argc, argv)) return 0; optind = 1; optarg = 0; while( ( cc = getopt( argc, argv, GETOPT_CMDSTRING)) != EOF ) { switch ( cc ) { case 'w': op = WRI; break; case 'r': op = REC; break; case 'q': op = QUE; break; case 'd': op = DEL; break; case 'z': op = MP; break; case 'g': op = QUE2; break; case 'u': uuid = optarg; break; case 'L': label = optarg; break; case 's': nsess = atoi(optarg); break; case 'l': level = atoi(optarg); break; case 't': nstreams = atoi(optarg); break; case 'm': nmedia = atoi( optarg ); break; case 'v': break; case 'f': sesfile = optarg; break; default: usage(); break; } } if ( op == WRI ) rval = write_test( nsess, nstreams, nmedia, level ); else if ( op == QUE ) rval = query_test( level ); else if ( op == REC ) rval = recons_test( nsess ); else if ( op == DEL ) rval = delete_test( nsess ); else if ( op == MP ) rval = mp_test (nstreams); else if ( op == QUE2 ) { if (uuid) rval = sess_queries_byuuid(uuid); else if (label) rval = sess_queries_bylabel(label); } else usage(); if (rval < 0 ) printf( "aborted\n"); else printf( "done\n" ); }