本文整理汇总了C++中profile_init函数的典型用法代码示例。如果您正苦于以下问题:C++ profile_init函数的具体用法?C++ profile_init怎么用?C++ profile_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了profile_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pa_log_debug
pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_hs_role) {
pa_bluetooth_backend *backend;
DBusError err;
pa_log_debug("Bluetooth Headset Backend API support using the native backend");
backend = pa_xnew0(pa_bluetooth_backend, 1);
backend->core = c;
dbus_error_init(&err);
if (!(backend->connection = pa_dbus_bus_get(c, DBUS_BUS_SYSTEM, &err))) {
pa_log("Failed to get D-Bus connection: %s", err.message);
dbus_error_free(&err);
pa_xfree(backend);
return NULL;
}
backend->discovery = y;
backend->enable_hs_role = enable_hs_role;
if (enable_hs_role)
profile_init(backend, PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY);
profile_init(backend, PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT);
return backend;
}
示例2: paths
/* Set the profile paths in the context. If secure is set to TRUE
then do not include user paths (from environment variables, etc).
If kdc is TRUE, include kdc.conf from whereever we expect to find
it. */
static krb5_error_code
os_init_paths(krb5_context ctx, krb5_boolean kdc)
{
krb5_error_code retval = 0;
profile_filespec_t *files = 0;
krb5_boolean secure = ctx->profile_secure;
#ifdef KRB5_DNS_LOOKUP
ctx->profile_in_memory = 0;
#endif /* KRB5_DNS_LOOKUP */
retval = os_get_default_config_files(&files, secure);
if (retval == 0 && kdc)
retval = add_kdc_config_file(&files);
if (!retval) {
retval = profile_init((const_profile_filespec_t *) files,
&ctx->profile);
#ifdef KRB5_DNS_LOOKUP
/* if none of the filenames can be opened use an empty profile */
if (retval == ENOENT) {
retval = profile_init(NULL, &ctx->profile);
if (!retval)
ctx->profile_in_memory = 1;
}
#endif /* KRB5_DNS_LOOKUP */
}
if (files)
free_filespecs(files);
if (retval)
ctx->profile = 0;
if (retval == ENOENT)
return KRB5_CONFIG_CANTOPEN;
if ((retval == PROF_SECTION_NOTOP) ||
(retval == PROF_SECTION_SYNTAX) ||
(retval == PROF_RELATION_SYNTAX) ||
(retval == PROF_EXTRA_CBRACE) ||
(retval == PROF_MISSING_OBRACE))
return KRB5_CONFIG_BADFORMAT;
return retval;
}
示例3: main
int main (int argc, char **argv)
{
if (argc <= 1) {
_help_msg();
exit(0);
}
_set_options(argc, argv);
profile_init();
switch (params.mode) {
case SH5UTIL_MODE_MERGE:
info("Merging node-step files into %s",
params.output);
_merge_step_files();
break;
case SH5UTIL_MODE_EXTRACT:
info("Extracting job data from %s into %s\n",
params.input, params.output);
_extract_data();
break;
default:
error("Unknown type %d", params.mode);
break;
}
profile_fini();
xfree(params.dir);
xfree(params.node);
return 0;
}
示例4: fit_init
void
fit_init(fitinfo *fit)
{
beam_init(&fit->beam);
pars_init(&fit->pars);
profile_init(&fit->p);
model_init(&fit->m);
interface_init(&fit->rm);
fit->m.rm = &fit->rm;
fit->capacity = -1;
fit->nQ = 0;
data_init(&fit->dataA);
data_init(&fit->dataB);
data_init(&fit->dataC);
data_init(&fit->dataD);
fit->worksize = 0;
fit->datatype = FIT_MAGNITUDE;
fit->weight = 1.;
fit->penalty = 0.;
/* Parameters to support incoherent sum of models */
fit->number_incoherent = 0;
fit->incoherent_models = NULL;
fit->incoherent_weights = NULL;
}
示例5: incoherent_unpolarized_theory
/* Incoherent sum of multiple models for unpolarized reflectometry */
static void incoherent_unpolarized_theory(fitinfo *fit)
{
Real total_weight; /* Total weight of all models */
int i, k;
profile p; /* Incoherent model profile */
Real *A, *B, *C, *D;
/* Make space for incoherent models. */
extend_work(fit,4*fit->nQ);
A = fit->work;
B = fit->work + fit->nQ;
C = fit->work + 2*fit->nQ;
D = fit->work + 3*fit->nQ;
/* Incoherent sum of the theory functions. */
profile_init(&p);
for (i=0; i < fit->number_incoherent; i++) {
profile_reset(&p);
model_profile(fit->incoherent_models[i], &p);
/* profile_print(&p,NULL); */
if (fit->m.is_magnetic) {
#ifdef HAVE_MAGNETIC
magnetic_reflectivity(p.n, p.d, p.rho,
p.mu,fit->beam.lambda, fit->beam.alignment,
p.P, p.expth,
fit->beam.Aguide, fit->nQ, fit->fitQ,
A, B, C, D);
for (k=0; k < fit->nQ; k++) {
A[k] = (A[k]+B[k]+C[k]+D[k])/2.;
}
#else
fprintf(stderr,"Need to configure with --enable-magnetic\n");
exit(1);
#endif
} else {
reflectivity(p.n, p.d, p.rho, p.mu, fit->beam.lambda,
fit->beam.alignment,
fit->nQ, fit->fitQ, A);
}
for (k=0; k < fit->nQ; k++) {
fit->fitA[k] += A[k] * fit->incoherent_weights[i];
}
}
profile_destroy(&p);
/* Incoherent sum of models requires relative model weighting.
* The base model is assumed to have weight 1. The remaining
* models can have their weights adjusted, with the result
* normalized by the total weight. */
total_weight = 1.;
for (i=0; i < fit->number_incoherent; i++) {
total_weight += fit->incoherent_weights[i];
}
for (k=0; k < fit->nQ; k++) {
fit->fitA[k] /= total_weight;
}
}
示例6: pa_bluetooth_native_backend_enable_hs_role
void pa_bluetooth_native_backend_enable_hs_role(pa_bluetooth_backend *native_backend, bool enable_hs_role) {
if (enable_hs_role == native_backend->enable_hs_role)
return;
if (enable_hs_role)
profile_init(native_backend, PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY);
else
profile_done(native_backend, PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY);
native_backend->enable_hs_role = enable_hs_role;
}
示例7: profile_init_path
errcode_t KRB5_CALLCONV
profile_init_path(const_profile_filespec_list_t filepath,
profile_t *ret_profile)
{
int n_entries, i;
unsigned int ent_len;
const char *s, *t;
profile_filespec_t *filenames;
errcode_t retval;
/* count the distinct filename components */
for(s = filepath, n_entries = 1; *s; s++) {
if (*s == ':')
n_entries++;
}
/* the array is NULL terminated */
filenames = (profile_filespec_t*) malloc((n_entries+1) * sizeof(char*));
if (filenames == 0)
return ENOMEM;
/* measure, copy, and skip each one */
for(s = filepath, i=0; ((t = strchr(s, ':')) != NULL) ||
((t=s+strlen(s)) != NULL); s=t+1, i++) {
ent_len = t-s;
filenames[i] = (char*) malloc(ent_len + 1);
if (filenames[i] == 0) {
/* if malloc fails, free the ones that worked */
while(--i >= 0) free(filenames[i]);
free(filenames);
return ENOMEM;
}
strncpy(filenames[i], s, ent_len);
filenames[i][ent_len] = 0;
if (*t == 0) {
i++;
break;
}
}
/* cap the array */
filenames[i] = 0;
retval = profile_init((const_profile_filespec_t *) filenames,
ret_profile);
/* count back down and free the entries */
while(--i >= 0) free(filenames[i]);
free(filenames);
return retval;
}
示例8: setup
void setup (void)
{
dbug_init();
sock_init();
#if defined(USE_PROFILER)
if (!profile_enable)
{
profile_enable = 1;
if (!profile_init())
exit (-1);
}
#endif
}
示例9: adev_open
static int adev_open(const hw_module_t* module, const char* name, hw_device_t** device)
{
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
return -EINVAL;
struct audio_device *adev = calloc(1, sizeof(struct audio_device));
if (!adev)
return -ENOMEM;
profile_init(&adev->out_profile, PCM_OUT);
profile_init(&adev->in_profile, PCM_IN);
adev->hw_device.common.tag = HARDWARE_DEVICE_TAG;
adev->hw_device.common.version = AUDIO_DEVICE_API_VERSION_2_0;
adev->hw_device.common.module = (struct hw_module_t *)module;
adev->hw_device.common.close = adev_close;
adev->hw_device.init_check = adev_init_check;
adev->hw_device.set_voice_volume = adev_set_voice_volume;
adev->hw_device.set_master_volume = adev_set_master_volume;
adev->hw_device.set_mode = adev_set_mode;
adev->hw_device.set_mic_mute = adev_set_mic_mute;
adev->hw_device.get_mic_mute = adev_get_mic_mute;
adev->hw_device.set_parameters = adev_set_parameters;
adev->hw_device.get_parameters = adev_get_parameters;
adev->hw_device.get_input_buffer_size = adev_get_input_buffer_size;
adev->hw_device.open_output_stream = adev_open_output_stream;
adev->hw_device.close_output_stream = adev_close_output_stream;
adev->hw_device.open_input_stream = adev_open_input_stream;
adev->hw_device.close_input_stream = adev_close_input_stream;
adev->hw_device.dump = adev_dump;
*device = &adev->hw_device.common;
return 0;
}
示例10: krb5_set_config_files
krb5_error_code
krb5_set_config_files(krb5_context ctx, const char **filenames)
{
krb5_error_code retval = 0;
profile_t profile;
retval = profile_init(filenames, &profile);
if (retval)
return retval;
if (ctx->profile)
profile_release(ctx->profile);
ctx->profile = profile;
return 0;
}
示例11: incoherent_polarized_theory
/* Incoherent sum of multiple models for polarized reflectometry */
static void incoherent_polarized_theory(fitinfo *fit)
{
#ifdef HAVE_MAGNETIC
Real total_weight; /* Total weight of all models */
int i, k;
profile p; /* Incoherent model profile */
Real *A,*B,*C,*D;
/* Make space for incoherent models. */
extend_work(fit,4*fit->nQ);
A = fit->work;
B = fit->work + fit->nQ;
C = fit->work + 2*fit->nQ;
D = fit->work + 3*fit->nQ;
/* Incoherent sum of the theory functions. */
profile_init(&p);
for (i=0; i < fit->number_incoherent; i++) {
model_profile(fit->incoherent_models[i], &p);
magnetic_reflectivity(p.n, p.d, p.rho, p.mu, fit->beam.lambda,
fit->beam.alignment,
p.P, p.expth, fit->beam.Aguide, fit->nQ, fit->fitQ, A,B,C,D);
for (k=0; k < fit->nQ; k++) {
fit->fitA[k] += A[k] * fit->incoherent_weights[i];
fit->fitB[k] += B[k] * fit->incoherent_weights[i];
fit->fitC[k] += C[k] * fit->incoherent_weights[i];
fit->fitD[k] += D[k] * fit->incoherent_weights[i];
}
}
profile_destroy(&p);
/* Incoherent sum of models requires relative model weighting.
* The base model is assumed to have weight 1. The remaining
* models can have their weights adjusted, with the result
* normalized by the total weight. */
total_weight = 1.;
for (i=0; i < fit->number_incoherent; i++) {
total_weight += fit->incoherent_weights[i];
}
for (k=0; k < fit->nQ; k++) {
fit->fitA[k] /= total_weight;
fit->fitB[k] /= total_weight;
fit->fitC[k] /= total_weight;
fit->fitD[k] /= total_weight;
}
#endif
}
示例12: profile_copy
errcode_t KRB5_CALLCONV
profile_copy(profile_t old_profile, profile_t *new_profile)
{
size_t size, i;
const_profile_filespec_t *files;
prf_file_t file;
errcode_t err;
/* The fields we care about are read-only after creation, so
no locking is needed. */
COUNT_LINKED_LIST (size, prf_file_t, old_profile->first_file, next);
files = malloc ((size+1) * sizeof(*files));
if (files == NULL)
return ENOMEM;
for (i = 0, file = old_profile->first_file; i < size; i++, file = file->next)
files[i] = file->data->filespec;
files[size] = NULL;
err = profile_init (files, new_profile);
free (files);
return err;
}
示例13: profiling_store
static ssize_t profiling_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
int ret;
if (prof_on)
return -EEXIST;
/*
* This eventually calls into get_option() which
* has a ton of callers and is not const. It is
* easiest to cast it away here.
*/
profile_setup((char *)buf);
ret = profile_init();
if (ret)
return ret;
ret = create_proc_profile();
if (ret)
return ret;
return count;
}
示例14: PRS
//.........这里部分代码省略.........
(ctx->options & E2F_OPT_COMPRESS_DIRS)) {
com_err(ctx->program_name, 0,
_("The -n and -D options are incompatible."));
fatal_error(ctx, 0);
}
if ((ctx->options & E2F_OPT_NO) && cflag) {
com_err(ctx->program_name, 0,
_("The -n and -c options are incompatible."));
fatal_error(ctx, 0);
}
if ((ctx->options & E2F_OPT_NO) && bad_blocks_file) {
com_err(ctx->program_name, 0,
_("The -n and -l/-L options are incompatible."));
fatal_error(ctx, 0);
}
if (ctx->options & E2F_OPT_NO)
ctx->options |= E2F_OPT_READONLY;
ctx->io_options = strchr(argv[optind], '?');
if (ctx->io_options)
*ctx->io_options++ = 0;
ctx->filesystem_name = blkid_get_devname(ctx->blkid, argv[optind], 0);
if (!ctx->filesystem_name) {
com_err(ctx->program_name, 0, _("Unable to resolve '%s'"),
argv[optind]);
fatal_error(ctx, 0);
}
if (extended_opts)
parse_extended_opts(ctx, extended_opts);
if ((cp = getenv("E2FSCK_CONFIG")) != NULL)
config_fn[0] = cp;
profile_set_syntax_err_cb(syntax_err_report);
profile_init(config_fn, &ctx->profile);
if (flush) {
fd = open(ctx->filesystem_name, O_RDONLY, 0);
if (fd < 0) {
com_err("open", errno,
_("while opening %s for flushing"),
ctx->filesystem_name);
fatal_error(ctx, 0);
}
if ((retval = ext2fs_sync_device(fd, 1))) {
com_err("ext2fs_sync_device", retval,
_("while trying to flush %s"),
ctx->filesystem_name);
fatal_error(ctx, 0);
}
close(fd);
}
if (cflag && bad_blocks_file) {
fprintf(stderr, _("The -c and the -l/-L options may "
"not be both used at the same time.\n"));
exit(FSCK_USAGE);
}
#ifdef HAVE_SIGNAL_H
/*
* Set up signal action
*/
memset(&sa, 0, sizeof(struct sigaction));
sa.sa_handler = signal_cancel;
sigaction(SIGINT, &sa, 0);
sigaction(SIGTERM, &sa, 0);
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
示例15: stage2_stat_init
/*-------------------------------------------------------------------------*/
void
stage2_stat_init(stage2_stat_t *stats)
{
memset(stats, 0, sizeof(stage2_stat_t));
profile_init(&stats->profile, PROF_MAX);
}