void G1MarkSweep::mark_sweep_phase2() { // Now all live objects are marked, compute the new object addresses. // It is not required that we traverse spaces in the same order in // phase2, phase3 and phase4, but the ValidateMarkSweep live oops // tracking expects us to do so. See comment under phase4. GCTraceTime tm("phase 2", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); GenMarkSweep::trace("2"); prepare_compaction(); }
void os3_flcf(tom::os3_volume<T>* searchV,tom::os3_volume<T>* patternV, tom::os3_volume<T>* maskV){ patternV->applyMask(maskV); patternV->calculateStatisticVolumes(maskV); tom::Volume<T> tm(*patternV->getMeanVolume()); tom::Volume<T> ts(*patternV->getStdVolume()); T patternMean = patternV->getCentralMean(); T patternStd = patternV->getCentralStd(); if(!searchV->equalSize(maskV)){ tom::os3_volume<T> biggerMask(maskV); biggerMask.resize(searchV); searchV->calculateStatisticVolumes(&biggerMask); } else searchV->calculateStatisticVolumes(maskV); if(! searchV->equalSize(patternV)) patternV->resize(searchV); tom::Volume<T> meanVolume(*searchV->getMeanVolume()); tom::Volume<T> stdVolume(*searchV->getStdVolume()); os3_correlate(searchV,patternV,false); tom::Volume<T>* correlationResult = patternV->getVolume(); correlationResult->shift_scale((T)0.0,(T)(1.0/(searchV->numel() * (double)maskV->getInnerSum()))); correlationResult->shift_scale((T)0.0,(T)10000.0); /* mu_seachV * mu_patternV */ meanVolume.shift_scale((T)0.0,patternMean); meanVolume.shift_scale((T)0.0,(T)10000.0); /*std_searchV * std_patternV*/ stdVolume.shift_scale((T)0.,patternStd); // patternStd stdVolume.shift_scale((T)0.0,(T)10000.0); tom::element_wise_sub(*correlationResult,meanVolume); tom::element_wise_div(*correlationResult,stdVolume,(T)0.0); patternV->replaceCurrentPlan(searchV); }
BOOL BackFile(CString& strFileIn) { CString strBackFile = strFileIn; int nPos = strFileIn.ReverseFind('.'); if (nPos) { CTime tm(time(NULL)); CString strTime = tm.Format(TEXT("%Y%m%d-%H%M%S")); strFileIn.Insert(nPos, strTime); return CopyFile(strFileIn, strBackFile, FALSE); } return FALSE; }
QSharedPointer<QGeoCachedTileMemory> QGeoTileCache::addToMemoryCache(const QGeoTileSpec &spec, const QByteArray &bytes, const QString &format) { QSharedPointer<QGeoCachedTileMemory> tm(new QGeoCachedTileMemory); tm->spec = spec; tm->cache = this; tm->bytes = bytes; tm->format = format; int cost = bytes.size(); memoryCache_.insert(spec, tm, cost); return tm; }
void RefProcTaskProxy::do_it(GCTaskManager* manager, uint which) { assert(Universe::heap()->is_gc_active(), "called outside gc"); NOT_PRODUCT(GCTraceTime tm("RefProcTask", PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(which); PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); PSParallelCompact::FollowStackClosure follow_stack_closure(cm); _rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(), mark_and_push_closure, follow_stack_closure); }
void PSMarkSweep::mark_sweep_phase4() { EventMark m("4 compact heap"); GCTraceTime tm("phase 4", PrintGCDetails && Verbose, true, _gc_timer, _gc_tracer->gc_id()); // All pointers are now adjusted, move objects accordingly ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); PSYoungGen* young_gen = heap->young_gen(); PSOldGen* old_gen = heap->old_gen(); old_gen->compact(); young_gen->compact(); }
SbTime operator +(const SbTime &t0, const SbTime &t1) // //////////////////////////////////////////////////////////////////////// { SbTime tm(t0.t.tv_sec + t1.t.tv_sec, t0.t.tv_usec + t1.t.tv_usec); if (tm.t.tv_usec >= 1000000) { tm.t.tv_sec += 1; tm.t.tv_usec -= 1000000; } return tm; }
//------------------------------------------------------------------------------ bool TreeModelWrapper::iter_parent_vfunc(const iterator& child, iterator& iter) const { // dprint("%s\n", __FUNCTION__); bool ret = false; if (tm()) { bec::NodeId node(node_for_iter(child)); if (node.is_valid()) { // Make iter (parent would be iterator) invalid from the start, just in case the code below // will fail reset_iter(iter); bec::NodeId would_be_parent(tm()->get_parent(node)); if (would_be_parent.is_valid()) { init_gtktreeiter(iter.gobj(), would_be_parent); ret = true; // dprint("%s(child->'%s', parent->'%s')\n", __FUNCTION__, bec::NodeId(tm->nodeuid_to_path(uid)).repr().c_str(), // would_be_parent.repr().c_str()); } } } return ret; }
bool ic3_engine::add_property(expr::term_ref P) { if (tm().term_of(P).op() == expr::TERM_AND) { size_t size = tm().term_of(P).size(); for (size_t i = 0; i < size; ++ i) { bool ok = add_property(tm().term_of(P)[i]); if (!ok) return false; } return true; } else { // Check at initial frame smt::solver_scope solver_scope; d_smt->ensure_counterexample_solver_depth(0); d_smt->get_counterexample_solver(solver_scope); solver_scope.push(); smt::solver* solver = solver_scope.get_solver(); // To check expr::term_ref P_neg = tm().mk_term(expr::TERM_NOT, P); expr::term_ref P_neg_0 = d_trace->get_state_formula(P_neg, 0); solver->add(P_neg_0, smt::solver::CLASS_A); // Should be SAT smt::solver::result result = solver->check(); if (result == smt::solver::UNSAT) { if (d_induction_frame.find(P) == d_induction_frame.end()) { add_to_induction_frame(P); enqueue_induction_obligation(induction_obligation(tm(), P, 0, 0, 0)); } bump_induction_obligation(P, 1); d_properties.insert(P); return true; } else { expr::model::ref model = solver->get_model(); d_trace->set_model(model, 1); return false; } } }
void StressTest::Finished(bool success) { win->stressTest = nullptr; // make sure we're not double-deleted if (success) { int secs = SecsSinceSystemTime(stressStartTime); AutoFreeW tm(FormatTime(secs)); AutoFreeW s(str::Format(L"Stress test complete, rendered %d files in %s", filesCount, tm)); win->ShowNotification(s, NOS_PERSIST, NG_STRESS_TEST_SUMMARY); } CloseWindow(win, exitWhenDone && MayCloseWindow(win)); delete this; }
void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { NOT_PRODUCT(GCTraceTime tm("UpdateDensePrefixTask", PrintGCDetails && TraceParallelOldGCTasks, true, NULL)); ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(which); PSParallelCompact::update_and_deadwood_in_dense_prefix(cm, _space_id, _region_index_start, _region_index_end); }
//------------------------------------------------------------------------ void CVehiclePartEntityAttachment::PostInit() { if (!m_pSharedParameters->m_helperPosName.empty()) { if (IVehicleHelper* pHelper = m_pVehicle->GetHelper(m_pSharedParameters->m_helperPosName)) SetLocalTM(pHelper->GetLocalTM()); else { Matrix34 tm(IDENTITY); SetLocalTM(tm); } } }
BOOL CChuquanData::IsAlreadyChuQuan(int nSeconds) { CTime tm(nSeconds); CString DateToAdd=tm.Format("%Y/%m/%d"); for( int i=0;i<this->m_ctrlChuQuan.GetItemCount();i++) { CString str=this->m_ctrlChuQuan.GetItemText(i,0); if( DateToAdd == str) return FALSE; } return TRUE; }
void forwardP(Args *args, Sequence *seq, FILE *snp) { int i, pos, maxStart, optStart; char *snpId, *alt, *hsName, *chr, *primer; hsName = (char *)emalloc(256); primer = (char *)emalloc(args->M + 1); alt = (char *)emalloc(256); snpId = (char *)emalloc(256); chr = (char *)emalloc(256); /* get name of hotspot */ strcpy(hsName, tabField(INT_FIELD)); while(fscanf(snp,"%s %d %s %*s %s %*s %*s %*s",chr,&pos,snpId,alt) != EOF){ pos--; /* zero-based counting within progr. */ maxStart = pos - args->M + 1; if (strchr(alt, ',')) continue; for (i = 0; i < args->M; i++) primer[i] = seq->seq[maxStart + i]; primer[i] = '\0'; /* print first primer */ optStart = optimalStartPos(args, primer, args->M - args->m); printf("%s\t%s\t%s\t%d\t", hsName, snpId, chr, pos + 1); for (i = optStart; i < args->M; i++) printf("%c", primer[i]); printf("\t%.2f\t%.1f\t", gc(primer, optStart), tm(primer, optStart)); primer[args->M - 1] = alt[0]; /* print second primer */ optStart = optimalStartPos(args, primer, args->M - args->m); for (i = optStart; i < args->M; i++) printf("%c", primer[i]); printf("\t%.2f\t%.1f\n", gc(primer, optStart), tm(primer, optStart)); } free(hsName); free(primer); free(alt); free(snpId); free(chr); }
void StressTest::Finished(bool success) { win->stressTest = NULL; // make sure we're not double-deleted if (success) { int secs = SecsSinceSystemTime(stressStartTime); ScopedMem<WCHAR> tm(FormatTime(secs)); ScopedMem<WCHAR> s(str::Format(L"Stress test complete, rendered %d files in %s", filesCount, tm)); win->ShowNotification(s, false, false, NG_STRESS_TEST_SUMMARY); } CloseWindow(win, exitWhenDone); delete this; }
bool tutorial_game::init(game *g) { // TODO: clean up old tutorial g->turn = HOURS(12); // Start at noon for (int i = 0; i < NUM_LESSONS; i++) tutorials_seen[i] = false; // Set the scent map to 0 for (int i = 0; i < SEEX * MAPSIZE; i++) { for (int j = 0; j < SEEX * MAPSIZE; j++) g->scent(i, j) = 0; } g->temperature = 65; // We use a Z-factor of 10 so that we don't plop down tutorial rooms in the // middle of the "real" game world g->u.normalize(g); g->u.str_cur = g->u.str_max; g->u.per_cur = g->u.per_max; g->u.int_cur = g->u.int_max; g->u.dex_cur = g->u.dex_max; //~ default name for the tutorial g->u.name = _("John Smith"); g->levx = 100; g->levy = 100; g->cur_om = &overmap_buffer.get(g, 0, 0); g->cur_om->make_tutorial(); g->cur_om->save(); g->u.toggle_trait("QUICK"); g->u.inv.push_back(item(itypes["lighter"], 0, 'e')); g->u.skillLevel("gun").level(5); g->u.skillLevel("melee").level(5); // Init the starting map at g location. for (int i = 0; i <= MAPSIZE; i += 2) { for (int j = 0; j <= MAPSIZE; j += 2) { tinymap tm(&g->traps); tm.generate(g, g->cur_om, g->levx + i - 1, g->levy + j - 1, 0, int(g->turn)); } } // Start with the overmap revealed for (int x = 0; x < OMAPX; x++) { for (int y = 0; y < OMAPY; y++) g->cur_om->seen(x, y, 0) = true; } g->m.load(g, g->levx, g->levy, 0); g->levz = 0; g->u.posx = SEEX + 2; g->u.posy = SEEY + 4; return true; }
CString GetRemDsc(CWPReminder& rem,BOOL bAddDate=FALSE) { CString sDsc=TrimMessage(rem.szText,30,1); if(sDsc==""){ sDsc=_l2("No description"); } COleDateTime tm(rem.EventTime); COleDateTime dtNow=COleDateTime::GetCurrentTime(); if(bAddDate && (tm.GetDay()!=dtNow.GetDay() || tm.GetMonth()!=dtNow.GetMonth() || tm.GetYear()!=dtNow.GetYear())){ return Format("%s %s %s",DateFormat(tm,TRUE),TimeFormat(tm),sDsc); }else{ return Format("%s %s",TimeFormat(tm),sDsc); } }
void state_trace::ensure_variables(size_t k) { assert(d_state_variables_structs.size() == d_input_variables_structs.size()); // Ensure we have enough while (d_state_variables_structs.size() <= k) { // State variable std::stringstream ss_state; ss_state << "s" << d_state_variables_structs.size(); expr::term_ref state_var_struct = tm().mk_variable(ss_state.str(), d_state_type->get_state_type_var()); d_state_variables_structs.push_back(expr::term_ref_strong(tm(), state_var_struct)); d_state_variables.push_back(std::vector<expr::term_ref>()); get_struct_variables(state_var_struct, d_state_variables.back()); // Input variable std::stringstream ss_input; ss_input << "i" << d_input_variables_structs.size(); expr::term_ref input_var_struct = tm().mk_variable(ss_input.str(), d_state_type->get_input_type_var()); d_input_variables_structs.push_back(expr::term_ref_strong(tm(), input_var_struct)); d_input_variables.push_back(std::vector<expr::term_ref>()); get_struct_variables(input_var_struct, d_input_variables.back()); // Add a new substitution map d_subst_maps_state_to_trace.push_back(expr::term_manager::substitution_map()); d_subst_maps_trace_to_state.push_back(expr::term_manager::substitution_map()); expr::term_manager::substitution_map& subst_state_to_trace = d_subst_maps_state_to_trace.back(); expr::term_manager::substitution_map& subst_trace_to_state = d_subst_maps_trace_to_state.back(); // Variables of the state type const std::vector<expr::term_ref>& state_vars = d_state_type->get_variables(state_type::STATE_CURRENT); // Variable to rename them to (k-the step) const std::vector<expr::term_ref>& frame_vars = d_state_variables.back(); for (size_t i = 0; i < state_vars.size(); ++ i) { subst_state_to_trace[state_vars[i]] = frame_vars[i]; subst_trace_to_state[frame_vars[i]] = state_vars[i]; } } assert(d_state_variables_structs.size() > k); assert(d_input_variables_structs.size() > k); }
bool tutorial_game::init(game *g) { g->turn = HOURS(12); // Start at noon for (int i = 0; i < NUM_LESSONS; i++) tutorials_seen[i] = false; // Set the scent map to 0 for (int i = 0; i < SEEX * MAPSIZE; i++) { for (int j = 0; j < SEEX * MAPSIZE; j++) g->scent(i, j) = 0; } g->temperature = 65; // We use a Z-factor of 10 so that we don't plop down tutorial rooms in the // middle of the "real" game world g->u.normalize(g); g->u.str_cur = g->u.str_max; g->u.per_cur = g->u.per_max; g->u.int_cur = g->u.int_max; g->u.dex_cur = g->u.dex_max; g->u.name = "John Smith"; g->levx = 100; g->levy = 100; g->cur_om = overmap(g, 0, 0, TUTORIAL_Z - 1); g->cur_om.make_tutorial(); g->cur_om.save(g->u.name, 0, 0, TUTORIAL_Z - 1); g->cur_om = overmap(g, 0, 0, TUTORIAL_Z); g->cur_om.make_tutorial(); g->u.toggle_trait(PF_QUICK); g->u.inv.push_back(item(g->itypes[itm_lighter], 0, 'e')); g->u.skillLevel("gun").level(5); g->u.skillLevel("melee").level(5); // Init the starting map at g location. for (int i = 0; i <= MAPSIZE; i += 2) { for (int j = 0; j <= MAPSIZE; j += 2) { tinymap tm(&g->itypes, &g->mapitems, &g->traps); tm.generate(g, &(g->cur_om), g->levx + i - 1, g->levy + j - 1, int(g->turn)); } } // Start with the overmap revealed for (int x = 0; x < OMAPX; x++) { for (int y = 0; y < OMAPY; y++) g->cur_om.seen(x, y) = true; } g->m.load(g, g->levx, g->levy); g->levz = 0; g->u.posx = SEEX + 2; g->u.posy = SEEY + 4; return true; }
void G1MarkSweep::mark_sweep_phase4() { // All pointers are now adjusted, move objects accordingly // The ValidateMarkSweep live oops tracking expects us to traverse spaces // in the same order in phase2, phase3 and phase4. We don't quite do that // here (code and comment not fixed for perm removal), so we tell the validate code // to use a higher index (saved from phase2) when verifying perm_gen. G1CollectedHeap* g1h = G1CollectedHeap::heap(); GCTraceTime(Info, gc, phases) tm("Phase 4: Move objects", gc_timer()); G1SpaceCompactClosure blk; g1h->heap_region_iterate(&blk); }
Matrix3 GetBoneTM(INode *pNode, TimeValue t) { Matrix3 tm(1); if(IsNodeBipedBone(pNode)) { // SetBipedScale(pNode, TRUE); tm = pNode->GetNodeTM(t); // SetBipedScale(pNode, FALSE); } else tm = pNode->GetNodeTM(t); // tm.NoScale(); return tm; }
void StressTest::Finished(bool success) { win->stressTest = NULL; SetThreadExecutionState(ES_CONTINUOUS); if (success) { int secs = SecsSinceSystemTime(stressStartTime); ScopedMem<TCHAR> tm(FormatTime(secs)); ScopedMem<TCHAR> s(str::Format(_T("Stress test complete, rendered %d files in %s"), filesCount, tm)); ShowNotification(win, s, false, false, NG_STRESS_TEST_SUMMARY); } CloseWindow(win, false, false); delete this; }
int main(int argc, char** argv){ if(argc < 2){ std::cout << "please specify the config file" << std::endl; std::cout << "run instructions : ./tm config.json [output.json]" << std::endl; return 1; } nlohmann::json config(nlohmann::json::parse(readFromFile(argv[1]))); //cout << "file : " << endl << readFromFile(argv[1]) << endl; TuringMachine tm(config); // tm._dump(); auto result =tm.run(TuringMachine::VERBOSE); return 0; }
void TransactionMatcher::accept(const MyMoneyTransaction& _t, const MyMoneySplit& _s) { if (_s.isMatched()) { MyMoneyTransaction tm(_t); MyMoneySplit sm(_s); sm.removeMatch(); sm.deletePair("kmm-orig-postdate"); sm.deletePair("kmm-orig-payee"); sm.deletePair("kmm-orig-memo"); sm.deletePair("kmm-match-split"); tm.modifySplit(sm); MyMoneyFile::instance()->modifyTransaction(tm); } }
Matrix3 FExtrudeMod::CompMatrix( TimeValue t,INode *inode,ModContext *mc) { Interval iv; Matrix3 tm(1); if (mc && mc->tm) tm = Inverse(*(mc->tm)); if (inode) { #ifdef DESIGN_VER tm = tm * inode->GetObjTMBeforeWSM(GetCOREInterface()->GetTime(),&iv); #else tm = tm * inode->GetObjTMBeforeWSM(t,&iv); #endif // DESIGN_VER } return tm; }
int PointHelpObject::HitTest( TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } Matrix3 tm(1); HitRegion hitRegion; DWORD savedLimits; Point3 pt(0,0,0); GraphicsWindow *gw = vpt->getGW(); gw->setTransform(tm); Material *mtl = gw->getMaterial(); tm = inode->GetObjectTM(t); MakeHitRegion(hitRegion, type, crossing, 4, p); gw->setRndLimits(((savedLimits = gw->getRndLimits())|GW_PICK)&~GW_ILLUM); gw->setHitRegion(&hitRegion); gw->clearHitCode(); DrawAndHit(t, inode, vpt); /* if (showAxis) { DrawAxis(vpt,tm,axisLength,screenSize); } gw->setTransform(tm); gw->marker(&pt,X_MRKR); */ gw->setRndLimits(savedLimits); // CAL-08/27/03: This doesn't make sense. It shouldn't do this. (Defect #468271) // This will always select this helper when there's an intersection on the bounding box and the selection window. // TODO: There's still a problem with window selection. We need to check if it hits all components in DrawAndHit. /* if((hitRegion.type != POINT_RGN) && !hitRegion.crossing) return TRUE; */ return gw->checkHitCode(); }
qore_absolute_time &qore_absolute_time::operator+=(const qore_relative_time &dt) { int usecs; // break down date and do day, month, and year math if (dt.year || dt.month || dt.day) { // get the broken-down date values for the date in local time qore_simple_tm2 tm(epoch + zone->getUTCOffset(epoch), us); #ifdef DEBUG // only needed by the debugging statement at the bottom //int64 oe=epoch; #endif //printd(5, "absolute_time::operator+= this=%p %lld.%06d (%d) %04d-%02d-%02d %02d:%02d:%02d.%06d (+%dY %dM %dD %dh %dm %ds %dus)\n", this, epoch, us, zone ? zone->getUTCOffset(epoch) : 0, tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second, tm.us, dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.us); // add years, months, and days tm.year += dt.year; tm.month += dt.month; // normalize to the end of the month normalize_dm(tm.year, tm.month, tm.day); tm.day += dt.day; // normalize to the correct day, month, and year normalize_day(tm.year, tm.month, tm.day); // get epoch offset for same time on the target day epoch = qore_date_info::getEpochSeconds(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second); // adjust for new UTC offset for target day at the original time epoch -= zone->getUTCOffset(epoch); usecs = tm.us; } else usecs = us; // get resulting microseconds usecs += dt.us; // add time component epoch += (SECS_PER_HOUR * dt.hour) + (SECS_PER_MINUTE * dt.minute) + dt.second; // normalize epoch and microseconds normalize_units2<int64, int>(epoch, usecs, 1000000); us = usecs; //printd(5, "absolute_time::operator+= new epoch=%lld.%06d (diff=%lld)\n", epoch, tm.us, epoch - oe); return *this; }
void PSMarkSweep::mark_sweep_phase4() { EventMark m("4 compact heap"); TraceTime tm("phase 4", PrintGCDetails && Verbose, true, gclog_or_tty); trace("4"); // All pointers are now adjusted, move objects accordingly ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); PSYoungGen* young_gen = heap->young_gen(); PSOldGen* old_gen = heap->old_gen(); old_gen->compact(); young_gen->compact(); }
//方式1:直接调用tm.runAll(-1, false),运行所有用例; //方式2:先调用tm.addSuite或tm.addTest添加要测试的用例,再调用tm.runAll()运行所添加的用例 int main(int argc, char **argv) { int ret = 0; TestSuiteManager<XmlTestReporter> tm(0); if (tm.Init(argc,argv) != 0) return -1; /**code start**/ //错误码注册 rating_charging::CErrorCodeManage::registerErrorCode(); tm.runAll(-1, false);//默认运行所有的用例 /**code end**/ if (tm.saveReport() != 0) return -1; return ret; }
static void test_win_F_HIDE_TIME() { const int timeFlags = 0 | 0 | PANTHEIOS_GETCURRENTTIME_F_HIDE_TIME | 0; pan_beutil_time_t tm(0, NULL); size_t expected = pantheios_util_getCurrentTime(&tm, timeFlags); PANTHEIOS_TEST_TIME( 0, timeFlags, expected, PANTHEIOS_LITERAL_STRING("")); { for(size_t i = 1; i < expected + 100; ++i) { PANTHEIOS_TEST_TIME( expected + i, timeFlags, expected, PANTHEIOS_LITERAL_STRING("*")); }} }