void os_config_write_uint(const char *section, const char *name, unsigned int value) { Profile *p = profile_read(Osreg_config_file_name); #ifdef WIN32 // When there is no config file then it shouldn't be created because that would "hide" all previous settings // Instead fall back to writing the settings to the config file if (p == nullptr) { registry_write_uint(section, name, value); return; } #endif if (section == NULL) section = DEFAULT_SECTION; char buf[21]; snprintf(buf, 20, "%u", value); p = profile_update(p, section, name, buf); profile_save(p, Osreg_config_file_name); profile_free(p); }
/** * Report a profiling test result * * @v test Profiling test * @v file Test code file * @v line Test code line */ static void profile_okx ( struct profile_test *test, const char *file, unsigned int line ) { struct profiler profiler; unsigned long mean; unsigned long stddev; unsigned int i; /* Initialise profiler */ memset ( &profiler, 0, sizeof ( profiler ) ); /* Record sample values */ for ( i = 0 ; i < test->count ; i++ ) profile_update ( &profiler, test->samples[i] ); /* Check resulting statistics */ mean = profile_mean ( &profiler ); stddev = profile_stddev ( &profiler ); DBGC ( test, "PROFILE calculated mean %ld stddev %ld\n", mean, stddev ); okx ( mean == test->mean, file, line ); okx ( stddev == test->stddev, file, line ); }
/** @snippet [ANT SDM update call] */ void ant_sdm_evt_handler(ant_sdm_profile_t * p_profile, ant_sdm_evt_t event) { switch (event) { case ANT_SDM_PAGE_1_UPDATED: /* fall through */ case ANT_SDM_PAGE_2_UPDATED: /* fall through */ case ANT_SDM_PAGE_3_UPDATED: /* fall through */ case ANT_SDM_PAGE_16_UPDATED: /* fall through */ case ANT_SDM_PAGE_22_UPDATED: /* fall through */ case ANT_SDM_PAGE_80_UPDATED: /* fall through */ case ANT_SDM_PAGE_81_UPDATED: profile_update(); break; default: break; } }