int main(int argc, char *argv[]) { /* Initialize times to get them in the cache */ int i, n; clear_cache(); setup_pointers(); for (i = 0; i < NTIMES; i++) times[i] = 0.0; n = 0; times[n++] = time_funct(procA, b1); times[n++] = time_funct(procA, b2); times[n++] = time_funct(procA, b3); times[n++] = time_funct(procA, b1); times[n++] = time_funct(procB, b1); times[n++] = time_funct(procB, b2); for (i = 0; i < n; i++) printf("%.0f cycles\n", times[i]); return 0; }
//---------------------------------------------------------------------- // Try old method of loading symbols bool old_pdb_plugin(ea_t loaded_base, const char *input, const char *spath) { bool ok = false; bool must_free; if ( setup_pointers(&must_free) ) { pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_FAVOR_COMPRESSED|SYMOPT_NO_PROMPTS); void *fake_proc = (void *)0xBEEFFEED; if ( !pSymInitialize(fake_proc, spath, FALSE) ) { error_msg("SymInitialize"); } else { DWORD64 symbase = pSymLoadModule64(fake_proc, 0, (char*)input, NULL, loaded_base, 0); if ( symbase != 0 ) { load_vc_til(); symbols_found = 0; adiff_t delta = adiff_t(loaded_base - symbase); ok = pSymEnumSymbols(fake_proc, symbase, NULL, EnumerateSymbolsProc, &delta) && symbols_found > 0; if ( !ok ) error_msg("EnumSymbols"); if ( !pSymUnloadModule64(fake_proc, symbase) ) error_msg("SymUnloadModule64"); } if ( !pSymCleanup(fake_proc) ) error_msg("SymCleanup"); } if ( must_free ) { FreeLibrary(dbghelp); dbghelp = NULL; } } return ok; }
void setup_indexing(void) { setup_pointers(); }
long solve(void) { int i; int iter; double *dx, *ds, *dy, *dz; double minval; double alpha; work.converged = 0; setup_pointers(); pre_ops(); #ifndef ZERO_LIBRARY_MODE if (settings.verbose) printf("iter objv gap |Ax-b| |Gx+s-h| step\n"); #endif fillq(); fillh(); fillb(); if (settings.better_start) better_start(); else set_start(); for (iter = 0; iter < settings.max_iters; iter++) { for (i = 0; i < 84; i++) { work.s_inv[i] = 1.0 / work.s[i]; work.s_inv_z[i] = work.s_inv[i]*work.z[i]; } work.block_33[0] = 0; fill_KKT(); ldl_factor(); /* Affine scaling directions. */ fillrhs_aff(); ldl_solve(work.rhs, work.lhs_aff); refine(work.rhs, work.lhs_aff); /* Centering plus corrector directions. */ fillrhs_cc(); ldl_solve(work.rhs, work.lhs_cc); refine(work.rhs, work.lhs_cc); /* Add the two together and store in aff. */ for (i = 0; i < 294; i++) work.lhs_aff[i] += work.lhs_cc[i]; /* Rename aff to reflect its new meaning. */ dx = work.lhs_aff; ds = work.lhs_aff + 114; dz = work.lhs_aff + 198; dy = work.lhs_aff + 282; /* Find min(min(ds./s), min(dz./z)). */ minval = 0; for (i = 0; i < 84; i++) if (ds[i] < minval*work.s[i]) minval = ds[i]/work.s[i]; for (i = 0; i < 84; i++) if (dz[i] < minval*work.z[i]) minval = dz[i]/work.z[i]; /* Find alpha. */ if (-0.99 < minval) alpha = 1; else alpha = -0.99/minval; /* Update the primal and dual variables. */ for (i = 0; i < 114; i++) work.x[i] += alpha*dx[i]; for (i = 0; i < 84; i++) work.s[i] += alpha*ds[i]; for (i = 0; i < 84; i++) work.z[i] += alpha*dz[i]; for (i = 0; i < 12; i++) work.y[i] += alpha*dy[i]; work.gap = eval_gap(); work.eq_resid_squared = calc_eq_resid_squared(); work.ineq_resid_squared = calc_ineq_resid_squared(); #ifndef ZERO_LIBRARY_MODE if (settings.verbose) { work.optval = eval_objv(); printf("%3d %10.3e %9.2e %9.2e %9.2e % 6.4f\n", iter+1, work.optval, work.gap, sqrt(work.eq_resid_squared), sqrt(work.ineq_resid_squared), alpha); } #endif /* Test termination conditions. Requires optimality, and satisfied */ /* constraints. */ if ( (work.gap < settings.eps) && (work.eq_resid_squared <= settings.resid_tol*settings.resid_tol) && (work.ineq_resid_squared <= settings.resid_tol*settings.resid_tol) ) { work.converged = 1; work.optval = eval_objv(); return iter+1; } } return iter; }
void setup_indexing(void) { setup_pointers(); setup_indexed_params(); setup_indexed_optvars(); }
int parse_manifest(plugin_manifest_t m, xmlNode * root, iconv_t conv) { int rv; xmlAttr * attr; xmlNode * cur; /* Initialize Version Information */ m->plugin_info.plugin_major_version = 0; m->plugin_info.plugin_minor_version = 0; m->plugin_info.plugin_patch_version = 0; /* Parse Attributes */ for (attr = root->properties ; attr ; attr = attr->next) { if (xmlStrcmp(attr->name, BAD_CAST("name")) == 0) { m->plugin_name = conv_xmlstr(attr->children->content, conv); } else if (xmlStrcmp(attr->name, BAD_CAST("library")) == 0) { m->plugin_library = conv_xmlstr(attr->children->content, conv); } else if (xmlStrcmp(attr->name, BAD_CAST("version")) == 0) { std::string verstr = conv_xmlstr(attr->children->content, conv); rv = sscanf(verstr.c_str(), "%hhu.%hhu.%hhu", & m->plugin_info.plugin_major_version, & m->plugin_info.plugin_minor_version, & m->plugin_info.plugin_patch_version); if (rv < 0) { g_parser_errmsg = "Invalid version string: '" + verstr + "'"; return MANIFEST_ERR_PARSER; } } else { g_parser_errmsg = "Unsupported Attribute: '" + conv_xmlstr(attr->name, conv) + "' within <plugin>"; return MANIFEST_ERR_PARSER; } } /* Check Name and Library */ if (m->plugin_name.empty()) return MANIFEST_ERR_NONAME; if (m->plugin_library.empty()) return MANIFEST_ERR_NOLIB; /* Parse Drivers */ for (cur = root->children ; cur ; cur = cur->next) { if (cur->type != XML_ELEMENT_NODE) continue; if (xmlStrcmp(cur->name, BAD_CAST("driver")) == 0) { rv = parse_driver(m, cur, conv); if (rv != 0) return rv; } else { g_parser_errmsg = "Unsupported node <" + conv_xmlstr(cur->name, conv) + "> within <plugin>"; return MANIFEST_ERR_PARSER; } } /* Setup String Pointers */ setup_pointers(m); /* Success */ return 0; }