OPENVPN_EXPORT int openvpn_plugin_func_v1(openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[]) { struct plugin_context *context = (struct plugin_context *) handle; if (type == OPENVPN_PLUGIN_UP) { PrintTime(); printf("PLUGIN: Starting firewall\n"); if (context->pktFilter.StartFirewall()) return OPENVPN_PLUGIN_FUNC_SUCCESS; else { PrintTime(); printf("PLUGIN: Start failed!\n"); return OPENVPN_PLUGIN_FUNC_ERROR; } } if (type == OPENVPN_PLUGIN_DOWN) { PrintTime(); printf("PLUGIN: Stopping firewall\n"); if (context->pktFilter.StopFirewall()) return OPENVPN_PLUGIN_FUNC_SUCCESS; else { PrintTime(); printf("PLUGIN: Can't stop firewall!\n"); return OPENVPN_PLUGIN_FUNC_ERROR; } } PrintTime(); printf("PLUGIN: Unknown handler!\n"); return OPENVPN_PLUGIN_FUNC_SUCCESS; }
bool RsaDevice_GenEntropyRequest(RsaDevice d, BIGNUM* commit_x, BIGNUM* commit_y) { if(d->x || d->y) return false; PrintTime("Getting x, y, r_p, r_q"); CHECK_CALL(d->x = RsaParams_RandomLargeValue(d->params)); CHECK_CALL(d->y = RsaParams_RandomLargeValue(d->params)); CHECK_CALL(d->rand_p = IntegerGroup_RandomExponent(RsaParams_GetGroup(d->params))); CHECK_CALL(d->rand_q = IntegerGroup_RandomExponent(RsaParams_GetGroup(d->params))); PrintTime("...done"); bool retval = (d->x && d->y && d->rand_p && d->rand_q); PrintTime("Generating C(x), C(y)"); BIGNUM* cx = IntegerGroup_Commit(RsaParams_GetGroup(d->params), d->x, d->rand_p); BIGNUM* cy = IntegerGroup_Commit(RsaParams_GetGroup(d->params), d->y, d->rand_q); PrintTime("...done"); CHECK_CALL(cx); CHECK_CALL(cy); CHECK_CALL(BN_copy(commit_x, cx)); CHECK_CALL(BN_copy(commit_y, cy)); BN_clear_free(cx); BN_clear_free(cy); return retval; }
VOID SyscallExit(THREADID threadIndex, CONTEXT *ctxt, SYSCALL_STANDARD std, VOID *v) { if(thread_to_syscall[threadIndex].ip == 0) return; if(thread_to_syscall[threadIndex].num == SYS_mmap) { void *ret = (void *)(PIN_GetSyscallReturn(ctxt, std)); assert(ret != NULL); if(ret != MAP_FAILED) { ADDRINT *args = &thread_to_syscall[threadIndex].args[0]; void *given_addr = (void *)(*args++); size_t length = (size_t)(*args++); int prot = (int)(*args++); int flags = (int)(*args++); int fd = (int)(*args++); off_t offset = (off_t)(*args++); PrintTime(NULL); output_dummy_stacktrace(); mprintf("mtrace_mmap(%p, %lu, %d, %d, %d, %lu) = %p\n", given_addr, length, prot, flags, fd, offset, ret); void *addr_start = ret; void *addr_end = (void *)((UINT8 *) addr_start + length - 1); (void) given_addr; (void) offset; if(flags & MAP_FIXED) { MemregionTracker::remove_overlaps(addr_start, addr_end); } if((flags & MAP_SHARED) && (prot & PROT_WRITE) && !(flags & MAP_ANON) && !(flags & MAP_ANONYMOUS) && (fd > 0)) { MemregionTracker::insert(addr_start, addr_end); } } } if(thread_to_syscall[threadIndex].num == SYS_munmap) { int ret = static_cast<int>(PIN_GetSyscallReturn(ctxt, std)); if(ret != -1) { ADDRINT *args = &thread_to_syscall[threadIndex].args[0]; void *addr_start = (void *)(*args++); size_t length = (size_t)(*args++); PrintTime(NULL); output_dummy_stacktrace(); mprintf("mtrace_munmap(%p, %lu) = %d\n", addr_start, length, ret); void *addr_end = (void *)((UINT8 *) addr_start + length - 1); MemregionTracker::remove_overlapping_regions(addr_start, addr_end); } } }
void CTick::Display() { PrintTime(_L("Start time"),iStartTime); TInt i; for (i=0; i<4; i++) { TBuf<16> name; name.Format(_L("Beat %d"),i); PrintTime(name,iTimes[i]); } }
static void BKZStatus(double tt, double enum_time, unsigned long NumIterations, unsigned long NumTrivial, unsigned long NumNonTrivial, unsigned long NumNoOps, long m, const mat_ZZ& B) { cerr << "---- BKZ_XD status ----\n"; cerr << "elapsed time: "; PrintTime(cerr, tt-StartTime); cerr << ", enum time: "; PrintTime(cerr, enum_time); cerr << ", iter: " << NumIterations << "\n"; cerr << "triv: " << NumTrivial; cerr << ", nontriv: " << NumNonTrivial; cerr << ", no ops: " << NumNoOps; cerr << ", rank: " << m; cerr << ", swaps: " << NumSwaps << "\n"; ZZ t1; long i; double prodlen = 0; for (i = 1; i <= m; i++) { InnerProduct(t1, B(i), B(i)); if (!IsZero(t1)) prodlen += log(t1); } cerr << "log of prod of lengths: " << prodlen/(2.0*log(2.0)) << "\n"; if (LLLDumpFile) { cerr << "dumping to " << LLLDumpFile << "..."; ofstream f; OpenWrite(f, LLLDumpFile); f << "["; for (i = 1; i <= m; i++) { f << B(i) << "\n"; } f << "]\n"; f.close(); cerr << "\n"; } LastTime = tt; }
void TestStringArraySort(std::ofstream& out, unsigned int const size, bool const isRandom = true) { CTimsortParamsDefault defaultParameters; if(isRandom) { clock_t timeBeginTimsort, timeEndTimsort, timeBeginStdsort, timeEndStdsort = 0; out << "Random string array of " << size << " elements" << std::endl; std::vector<std::string> inputVector; GenerateRandomStringArray(inputVector, size); std::vector<std::string> cloneVector = inputVector; timeBeginTimsort = clock(); Timsort<std::vector<std::string>::iterator, bool (*)(std::string const&, std::string const&)>(inputVector.begin(), inputVector.end(), StringCompare, &defaultParameters); timeEndTimsort = clock(); timeBeginStdsort = clock(); std::sort(cloneVector.begin(), cloneVector.end(), StringCompare); timeEndStdsort = clock(); PrintTime(timeBeginTimsort, timeEndTimsort, out, "Timsort"); PrintTime(timeBeginStdsort, timeEndStdsort, out, "std::sort"); out << std::endl << std::endl; } else { clock_t timeBeginTimsort, timeEndTimsort, timeBeginStdsort, timeEndStdsort = 0; out << "Partially sorted string array of " << size << " elements" << std::endl; std::vector<std::string> inputVector; GeneratePartiallySortedStringArray(inputVector, size); std::vector<std::string> cloneVector = inputVector; timeBeginTimsort = clock(); Timsort<std::vector<std::string>::iterator, bool (*)(std::string const&, std::string const&)>(inputVector.begin(), inputVector.end(), StringCompare, &defaultParameters); timeEndTimsort = clock(); timeBeginStdsort = clock(); std::sort(cloneVector.begin(), cloneVector.end(), StringCompare); timeEndStdsort = clock(); PrintTime(timeBeginTimsort, timeEndTimsort, out, "Timsort"); PrintTime(timeBeginStdsort, timeEndStdsort, out, "std::sort"); out << std::endl << std::endl; } }
void TestIntArraySort(std::ofstream& out, unsigned int const size, bool const isRandom = true) { CTimsortParamsDefault defaultParameters; if(isRandom) { clock_t timeBeginTimsort, timeEndTimsort, timeBeginStdsort, timeEndStdsort = 0; out << "Random array of " << size << " elements" << std::endl; std::vector<int> inputVector; GenerateRandomIntArray(inputVector, size); std::vector<int> cloneVector = inputVector; timeBeginTimsort = clock(); Timsort<std::vector<int>::iterator, std::less<int> >(inputVector.begin(), inputVector.end(), std::less<int>(), &defaultParameters); timeEndTimsort = clock(); timeBeginStdsort = clock(); std::sort(cloneVector.begin(), cloneVector.end(), std::less<int>()); timeEndStdsort = clock(); PrintTime(timeBeginTimsort, timeEndTimsort, out, "Timsort"); PrintTime(timeBeginStdsort, timeEndStdsort, out, "std::sort"); out << std::endl << std::endl; } else { clock_t timeBeginTimsort, timeEndTimsort, timeBeginStdsort, timeEndStdsort = 0; out << "Array of " << size << " partially sorted arrays" << std::endl; std::vector<std::vector<int> > arrayVector; GenerateArraysSequence(arrayVector, size); for(std::vector<std::vector<int> >::iterator start = arrayVector.begin(); start != arrayVector.end(); ++start) { out << "Partially sorted array number " << (start - arrayVector.begin()) + 1 << " of " << start->size() << " elements" << std::endl; std::vector<int> cloneVector = *start; timeBeginTimsort = clock(); Timsort<std::vector<int>::iterator, std::less<int> >(start->begin(), start->end(), std::less<int>(), &defaultParameters); timeEndTimsort = clock(); timeBeginStdsort = clock(); std::sort(cloneVector.begin(), cloneVector.end(), std::less<int>()); timeEndStdsort = clock(); PrintTime(timeBeginTimsort, timeEndTimsort, out, "Timsort"); PrintTime(timeBeginStdsort, timeEndStdsort, out, "std::sort"); out << std::endl << std::endl; } } }
int LoadPropFuncByConfigfile(const gboolean first_load) { #ifdef _UI_DEBUG PrintTime(); #endif if(g_config_file_data != NULL){ DealSpecialWidget(g_config_file_data->special_list); } #ifdef _UI_DEBUG PrintTime(); #endif LoadFunctions(first_load); return 0; }
/******************************************************************************************** * * * main * * * *********************************************************************************************/ int main(void) { char input1[10],input2[10]; int i=0, j=0, flag=0; time_t t0,t; t0=time(NULL); // tic printf("input1 >>\n"); scanf("%s",input1); while(1){ if(input1[i]=='\0'){ break;} i++; } printf("input2 >>\n"); scanf("%s",input2); while(1){ if(input2[j]=='\0'){ break;} j++; } isSubstring(input1, input2, i,j); t=time(NULL)-t0; // toc PrintTime(t); return(0); }
void SysLog::PrintMsg(Color color, char pfx, const char* source, const char* fmt, va_list ap) { if( !m_initialized ) return; MutexLock l( mMutex ); PrintTime(); SetColor( color ); Print( " %c ", pfx ); std::string pad = ""; if(strlen(source) < CONSOLE_LOG_PADDING) pad = std::string(CONSOLE_LOG_PADDING-strlen(source), ' '); if( source && *source ) { SetColor( COLOR_WHITE ); Print( "%s%s: ", pad.c_str(), source ); SetColor( color ); } PrintVa( fmt, ap ); Print( "\n" ); SetColor( COLOR_DEFAULT ); }
void HTML_Log::PrintMsg( Color color, char pfx, const char* source, const char* fmt, va_list ap ) { if( !m_initialized ) return; MutexLock l( mMutex ); PrintTime(); SetColor( color ); Print( " %c ", pfx ); if( source && *source ) { SetColor( COLOR_WHITE ); Print( "%s: ", source ); SetColor( color ); } PrintVa( fmt, ap ); Print( "\n" ); SetColor( COLOR_DEFAULT ); }
VOID EmitWrite(THREADID threadid, UINT32 size) { assert(size <= 100); char bytes[101]; struct timeval tv; VOID *ea = WriteEa[threadid]; if(MemregionTracker::address_mapped(ea)) { gettimeofday(&tv, NULL); PIN_SafeCopy(&bytes[0], static_cast<char *>(ea), size); bytes[size] = '\0'; m_dump_bytes(bytes, size); if(mwrite_tracker[threadid].next_location == ea && time_diff(tv, mwrite_tracker[threadid].last_time) < coalesce_microsecs) { mwrite_tracker[threadid].size += size; } else { flush_mwrite(threadid); PrintTime(&tv); output_stacktrace(); if(print_chars) { char tmp[100]; printable_string(bytes, tmp, 100); mprintf("mwrite(%p, \"%s\"..., ", ea, tmp); } else { mprintf("mwrite(%p, \"\"..., ", ea); } mwrite_tracker[threadid].size = size; } mwrite_tracker[threadid].next_location = (UINT8 *)ea + size; mwrite_tracker[threadid].last_time = tv; } }
void Console::CheckEndGroup() { for(int g = groups.GetCount(); --g >= 0;) { String gname = groups.GetKey(g); Group& group = groups[g]; if(!IsNull(gname) && group.finished) { int p = processes.GetCount(); while(--p >= 0 && !(!!processes[p].process && processes[p].group == gname)) ; if(p < 0) { if(group.count > 0) { int duration = msecs(group.start_time); String msg = NFormat("%s: %d file(s) built in %s, %d msecs / file, duration = %d msecs", gname, group.count, PrintTime(group.msecs), group.msecs / group.count, duration); if(processes.GetCount() > 1) { int k = 100 * processes.GetCount() / (processes.GetCount() - 1); msg << NFormat(", parallelization %d%%", minmax(k - group.msecs * k / max(group.raw_msecs, 1), 0, 100)); } msg << '\n'; spooled_output.Cat(msg); if(console_lock < 0) { Append(spooled_output); spooled_output = Null; } } groups.Remove(g); } } } }
static void RecordSystemInformation(HANDLE LogFile) { FILETIME CurrentTime; GetSystemTimeAsFileTime(&CurrentTime); char TimeBuffer[100]; PrintTime(TimeBuffer, CurrentTime); hprintf(LogFile, "Error occurred at %s.\r\n", TimeBuffer); char ModuleName[MAX_PATH]; if (GetModuleFileName(0, ModuleName, sizeof(ModuleName)) <= 0) { lstrcpy(ModuleName, "Unknown"); } char UserName[200]; DWORD UserNameSize = sizeof(UserName); if (!GetUserName(UserName, &UserNameSize)) { lstrcpy(UserName, "Unknown"); } hprintf(LogFile, "%s, run by %s.\r\n", ModuleName, UserName); SYSTEM_INFO SystemInfo; GetSystemInfo(&SystemInfo); hprintf(LogFile, "%d processor(s), type %d.\r\n", SystemInfo.dwNumberOfProcessors, SystemInfo.dwProcessorType); MEMORYSTATUS MemInfo; MemInfo.dwLength = sizeof(MemInfo); GlobalMemoryStatus(&MemInfo); // Print out the amount of physical memory, rounded up. hprintf(LogFile, "%d MBytes physical memory.\r\n", (MemInfo.dwTotalPhys + ONEM - 1) / ONEM); }
int main() { int i,n,len,j; char s1[9],s2[9]; freopen("poj3683.txt","r",stdin); freopen("poj3683ans.txt","w",stdout); while (scanf("%d",&n)!=EOF) { InitEdge(); for (i=1;i<=n;i++) { scanf("%s%s%d",s1,s2,&len); wed[i].start=TimeStrToInt(s1); wed[i].end=TimeStrToInt(s2); wed[i].len=len; } for (i=1;i<=n;i++) for (j=1;j<=n;j++) { if (i==j) continue; if (Conflict(wed[i].start,wed[i].len,wed[j].start,wed[j].len)) AddEdge(i,j+n); if (Conflict(wed[i].start,wed[i].len,wed[j].end-wed[j].len,wed[j].len)) AddEdge(i,j); if (Conflict(wed[i].end-wed[i].len,wed[i].len,wed[j].start,wed[j].len)) AddEdge(i+n,j+n); if (Conflict(wed[i].end-wed[i].len,wed[i].len,wed[j].end-wed[j].len,wed[j].len)) AddEdge(i+n,j); } if (TwoSAT(n)) { printf("YES\n"); for (i=1;i<=n;i++) if (ans[i]) { PrintTime(wed[i].start); printf(" "); PrintTime(wed[i].start+wed[i].len); printf("\n"); } else { PrintTime(wed[i].end-wed[i].len); printf(" "); PrintTime(wed[i].end); printf("\n"); } } else printf("NO\n"); } return 0; }
void DumpNTCounters(HANDLE InfoFile, PerfThread& Thread, DWORD dwPid, DWORD dwThreads) { fputc(L'\n',InfoFile); Lock l(&Thread); ProcessPerfData* pdata = Thread.GetProcessData(dwPid, dwThreads); if (!pdata) return; const PerfLib* pf = Thread.GetPerfLib(); for (size_t i=0; i<ARRAYSIZE(Counters); i++) { if (!pf->dwCounterTitles[i]) // counter is absent continue; wchar_t buf[28]; lstrcpyn(buf,GetMsg(Counters[i].idName),ARRAYSIZE(buf)-2); lstrcat(buf,L":"); fprintf(InfoFile, L"%-24s ", buf); switch (pf->CounterTypes[i]) { case PERF_COUNTER_RAWCOUNT: { // Display as is. No Display Suffix. fprintf(InfoFile, L"%10I64u\n", pdata->qwResults[i]); } break; case PERF_COUNTER_LARGE_RAWCOUNT: // same, large int { fprintf(InfoFile, L"%10.0f\n", (FLOAT)pdata->qwResults[i]); } break; case PERF_100NSEC_TIMER: { // 64-bit Timer in 100 nsec units. Display delta divided by // delta time. Display suffix: "%" //fprintf(InfoFile, L"%10.0f%%\n", (FLOAT)pdata->qwResults[i]); fprintf(InfoFile, L"%s %7.0f%%\n", PrintTime((ULONGLONG)pdata->qwCounters[i]), (FLOAT)pdata->qwResults[i]); } break; case PERF_COUNTER_COUNTER: { // 32-bit Counter. Divide delta by delta time. Display suffix: "/sec" fprintf(InfoFile, L"%10I64u %5I64u%s\n", pdata->qwCounters[i], pdata->qwResults[i], GetMsg(MperSec)); } break; case PERF_COUNTER_BULK_COUNT: //PERF_COUNTER_BULK_COUNT { // 64-bit Counter. Divide delta by delta time. Display Suffix: "/sec" fprintf(InfoFile, L"%10.0f %5.0f%s\n", (FLOAT)pdata->qwCounters[i], (FLOAT)pdata->qwResults[i], GetMsg(MperSec)); } break; default: fputc(L'\n',InfoFile); } } }
void LogLineBox::setTimeMode(RDAirPlayConf::TimeMode mode) { if(mode==line_time_mode) { return; } line_time_mode=mode; PrintTime(); }
void SolverMUX::PrintTimers() const { logout << "Solver EACH:"; for (size_t ind = 0; ind < m_solvers.Size(); ind++) { logout << " " << m_solvers[ind]->Name() << ": "; PrintTime(m_elapsed[ind]); } logout << endl; }
THREAD(TimeSyncThread, arg) { puts("\ntime started\n"); RegisterDevice(); puts("shit registered\n"); for (;;) { RetrieveTime(); PrintTime(); NutSleep(10000); } }
void AltJacobi::operator () (unsigned p,QType result[ /* (p-2)*p */ ]) const { Printf(Con,"Jacobi #; #;\n",prime,p); SecTimer timer; Table table(prime,gen,p); Printf(Con,"time = #;\n",PrintTime(timer.get())); for(unsigned k=1; k<p-1 ;k++,result+=p) table(k,result); }
//========================================================================// void DebugLevelLog::PrintString(const DEBUG_LEVEL_ENUM debug_level, const MESSAGE_TYPES_ENUM msg_type, const char* format_str, ...) { //printf("void DebugLevelLog::PrintString(format_str = <%s>) \n", format_str); if ( print_time ) PrintTime(debug_level); if(create_log_flag) { FILE * log = NULL; char * type_str = (char *) calloc(11, sizeof(char)); switch(msg_type) { case WARN : strcpy(type_str, "WARNING : "); break; case ERROR : strcpy(type_str, "ERROR : "); break; case FATAL : strcpy(type_str, "FATAL : "); break; case INFO : break; } switch(debug_level) { case LOGFILE : log = OpenLog(); if (log != NULL) { fprintf(log, type_str); va_list param; va_start(param, format_str); vfprintf(log, format_str, param); va_end(param); fclose(log); } break; case STDOUT : printf(type_str); va_list param; va_start(param, format_str); vprintf(format_str, param); va_end(param); break; } free(type_str); } //puts("DebugLevelLog :: PrinString ----- end"); }
/* * Make this public if we need it. */ static nsresult NS_TimelineMarkV(const char *text, va_list args) { PRTime elapsed,tmp; PR_CallOnce(&initonce, TimelineInit); TimelineThreadData *thread = GetThisThreadData(); tmp = Now(); LL_SUB(elapsed, tmp, thread->initTime); PrintTime(elapsed, text, args); return NS_OK; }
X509* RsaDevice_RunProtocol(RsaDevice d, bool ca_sign, const char* ea_hostname, int ea_port, const char* ca_hostname, int ca_port) { PrintTime("Connecting to EA"); CHECK_CALL(MakeSSLRequest(ea_hostname, ea_port, &RunEaSession, (void*)d)); PrintTime("Closed connection to EA"); struct ca_request_data rr; rr.client_type = RSA_CLIENT; rr.cert = X509_new(); CHECK_CALL(rr.cert); PrintTime("Generating CA request"); CHECK_CALL(RsaDevice_GenCaCertRequest(d, &(rr.cert))); PrintTime("Done generating CA request"); if(ca_sign) { PrintTime("Beginning CA session"); CHECK_CALL(MakeSSLRequest(ca_hostname, ca_port, &RequestCaSignatureClient, (void*)&rr)); } return rr.cert; }
int main() { Time T, Td; unsigned int Unit; while(scanf("%2d%2d%2d%2d", &T.HH, &T.MM, &T.SS, &T.CC)>0) { Unit = TimeToUnit(&T); UnitToTime(&Td, Unit); PrintTime(&Td); } return 0; }
static void PrintSources (const cc65_sourceinfo* S) /* Output a list of sources */ { unsigned I; const cc65_sourcedata* D; /* Segments */ for (I = 0, D = S->data; I < S->count; ++I, ++D) { PrintId (D->source_id, 8); Print ("%-30s", D->source_name); PrintNumber (D->source_size, 7, 9); PrintTime (D->source_mtime, 0); NewLine (); } }
// Print information about a code module (DLL or EXE) such as its size, // location, time stamp, etc. static void ShowModuleInfo(HANDLE LogFile, HINSTANCE ModuleHandle) { char ModName[MAX_PATH]; #ifdef _MSC_VER __try { #endif if (GetModuleFileName(ModuleHandle, ModName, sizeof(ModName)) > 0) { // If GetModuleFileName returns greater than zero then this must // be a valid code module address. Therefore we can try to walk // our way through its structures to find the link time stamp. IMAGE_DOS_HEADER *DosHeader = (IMAGE_DOS_HEADER*)ModuleHandle; if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic) { return; } IMAGE_NT_HEADERS *NTHeader = (IMAGE_NT_HEADERS*)((char *)DosHeader + DosHeader->e_lfanew); if (IMAGE_NT_SIGNATURE != NTHeader->Signature) { return; } // Open the code module file so that we can get its file date // and size. HANDLE ModuleFile = CreateFile(ModName, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); char TimeBuffer[100] = ""; DWORD FileSize = 0; if (ModuleFile != INVALID_HANDLE_VALUE) { FileSize = GetFileSize(ModuleFile, 0); FILETIME LastWriteTime; if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime)) { wsprintf(TimeBuffer, " - file date is "); PrintTime(TimeBuffer + lstrlen(TimeBuffer), LastWriteTime); } CloseHandle(ModuleFile); } hprintf(LogFile, "%s, loaded at 0x%08x - %d bytes - %08x%s\r\n", ModName, ModuleHandle, FileSize, NTHeader->FileHeader.TimeDateStamp, TimeBuffer); } #ifdef _MSC_VER } // Handle any exceptions by continuing from this point. __except(EXCEPTION_EXECUTE_HANDLER) { } #endif }
static void LLLStatus(long max_k, double t, long m, const mat_ZZ& B) { cerr << "---- LLL_XD status ----\n"; cerr << "elapsed time: "; PrintTime(cerr, t-StartTime); cerr << ", stage: " << max_k; cerr << ", rank: " << m; cerr << ", swaps: " << NumSwaps << "\n"; ZZ t1; long i; double prodlen = 0; for (i = 1; i <= m; i++) { InnerProduct(t1, B(i), B(i)); if (!IsZero(t1)) prodlen += log(t1); } cerr << "log of prod of lengths: " << prodlen/(2.0*log(2.0)) << "\n"; if (LLLDumpFile) { cerr << "dumping to " << LLLDumpFile << "..."; ofstream f; OpenWrite(f, LLLDumpFile); f << "["; for (i = 1; i <= m; i++) { f << B(i) << "\n"; } f << "]\n"; f.close(); cerr << "\n"; } LastTime = t; }
void InfoIdleScreen::Render(LCD& lcd, byte cols, byte rows) const { lcd.setCursor(0, 0); if (m_sequence->IsRunning()) { int _chars = 0; _chars += lcd.print(F("Shot ")); _chars += lcd.print(m_sequence->GetShotsFired()); _chars += lcd.print(F("/")); _chars += lcd.print(m_sequence->GetShotsTotal()); Pad(lcd, cols, _chars); _chars = 0; lcd.setCursor(0, 1); _chars += lcd.print(F("Rem. ")); long _secondsRemaining = m_sequence->GetSecondsRemaining(); _chars += PrintTime(_secondsRemaining, lcd); Pad(lcd, cols, _chars); } else { Pad(lcd, cols, lcd.print(F("Idle"))); lcd.setCursor(0, 1); Pad(lcd, cols, 0); } }
VOID SyscallEntry(THREADID threadIndex, CONTEXT *ctxt, SYSCALL_STANDARD std, VOID *v) { flush_mwrite(threadIndex); ADDRINT num = PIN_GetSyscallNumber(ctxt, std); if(num == SYS_execve) { PrintTime(NULL); output_dummy_stacktrace(); mprintf("mtrace_execve(%ld, %u, %u, %u, %u) = 0\n", syscall(SYS_gettid), PIN_GetTid(), getpid(), threadIndex, PIN_ThreadId()); m_dump_bytes(NULL, 0); return; } if (num != SYS_mmap && num != SYS_munmap) { thread_to_syscall[threadIndex].ip = 0; return; } thread_to_syscall[threadIndex].num = num; thread_to_syscall[threadIndex].ip = PIN_GetContextReg(ctxt, REG_INST_PTR); if(num == SYS_mmap) { for(int i = 0; i < 6; i++) { #if defined(TARGET_LINUX) && defined(TARGET_IA32) thread_to_syscall[threadIndex].args[i] = (reinterpret_cast<ADDRINT *>(PIN_GetSyscallArgument(ctxt, std, 0)))[i]; #else thread_to_syscall[threadIndex].args[i] = PIN_GetSyscallArgument(ctxt, std, i); #endif } } else { for(int i = 0; i < 2; i++) { thread_to_syscall[threadIndex].args[i] = PIN_GetSyscallArgument(ctxt, std, i); } } }
void test4() { PlatformRandom random; SecTimer timer; for(ulen cnt=1;;cnt++) { Printf(Con,"cnt = #;\r",cnt); Int P=RandomInt(32,random); if( P<0 ) P=-P; if( P.isEven() ) P=P+1; if( Math::NoPrimeTest<Int>::RandomTest(P,30,random) ) { Printf(Con,"\ntime = #;\nP = #;\nbits = #;\n",PrintTime(timer.get()),P,P.bitsOf().total()); return; } } }