本文整理汇总了C++中PrintStats函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintStats函数的具体用法?C++ PrintStats怎么用?C++ PrintStats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrintStats函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rand
void Fuzzer::ShuffleAndMinimize() {
size_t MaxCov = 0;
bool PreferSmall =
(Options.PreferSmallDuringInitialShuffle == 1 ||
(Options.PreferSmallDuringInitialShuffle == -1 && rand() % 2));
if (Options.Verbosity)
std::cerr << "PreferSmall: " << PreferSmall << "\n";
PrintStats("READ ", 0);
std::vector<Unit> NewCorpus;
std::random_shuffle(Corpus.begin(), Corpus.end());
if (PreferSmall)
std::stable_sort(
Corpus.begin(), Corpus.end(),
[](const Unit &A, const Unit &B) { return A.size() < B.size(); });
Unit &U = CurrentUnit;
for (const auto &C : Corpus) {
for (size_t First = 0; First < 1; First++) {
U.clear();
size_t Last = std::min(First + Options.MaxLen, C.size());
U.insert(U.begin(), C.begin() + First, C.begin() + Last);
size_t NewCoverage = RunOne(U);
if (NewCoverage) {
MaxCov = NewCoverage;
NewCorpus.push_back(U);
if (Options.Verbosity >= 2)
std::cerr << "NEW0: " << NewCoverage
<< " L " << U.size()
<< "\n";
}
}
}
Corpus = NewCorpus;
PrintStats("INITED", MaxCov);
}
示例2: ConsoleCtrlHandler
static
BOOL
WINAPI
ConsoleCtrlHandler(DWORD ControlType)
{
switch (ControlType)
{
case CTRL_C_EVENT:
PrintStats();
ConResPrintf(StdOut, IDS_CTRL_C);
return FALSE;
case CTRL_BREAK_EVENT:
PrintStats();
ConResPrintf(StdOut, IDS_CTRL_BREAK);
return TRUE;
case CTRL_CLOSE_EVENT:
PrintStats();
return FALSE;
default:
return FALSE;
}
}
示例3: Printf
void Fuzzer::ShuffleAndMinimize() {
bool PreferSmall = (Options.PreferSmallDuringInitialShuffle == 1 ||
(Options.PreferSmallDuringInitialShuffle == -1 &&
USF.GetRand().RandBool()));
if (Options.Verbosity)
Printf("PreferSmall: %d\n", PreferSmall);
PrintStats("READ ");
std::vector<Unit> NewCorpus;
if (Options.ShuffleAtStartUp) {
std::random_shuffle(Corpus.begin(), Corpus.end(), USF.GetRand());
if (PreferSmall)
std::stable_sort(
Corpus.begin(), Corpus.end(),
[](const Unit &A, const Unit &B) { return A.size() < B.size(); });
}
Unit &U = CurrentUnit;
for (const auto &C : Corpus) {
for (size_t First = 0; First < 1; First++) {
U.clear();
size_t Last = std::min(First + Options.MaxLen, C.size());
U.insert(U.begin(), C.begin() + First, C.begin() + Last);
if (Options.OnlyASCII)
ToASCII(U);
if (RunOne(U)) {
NewCorpus.push_back(U);
if (Options.Verbosity >= 2)
Printf("NEW0: %zd L %zd\n", LastRecordedBlockCoverage, U.size());
}
}
}
Corpus = NewCorpus;
for (auto &X : Corpus)
UnitHashesAddedToCorpus.insert(Hash(X));
PrintStats("INITED");
}
示例4: GetAsyncKeyState
void StatBooster::ProcessKeyStrokes(HANDLE processHandle, HWND windowHandle, int memoryAddress, bool &stopped, bool &active, bool &activeStatusChanged, CharStats *charStats, CharStats *storedCharStats, Stats *stats, POINT &store_btn_coord, POINT &recall_btn_coord, POINT &reroll_btn_coord)
{
int escKeyState = GetAsyncKeyState(VK_ESCAPE);
int f1KeyState = GetKeyState(VK_F1);
int f2KeyState = GetAsyncKeyState(VK_F2);
int f5KeyState = GetAsyncKeyState(VK_F5);
int f6KeyState = GetAsyncKeyState(VK_F6);
int f7KeyState = GetAsyncKeyState(VK_F7);
int f8KeyState = GetAsyncKeyState(VK_F8);
if (escKeyState != 0)
{
stopped = true;
}
if (f1KeyState == 0 || f1KeyState == 1)
{
if (active != (f1KeyState == 1))
{
active = (f1KeyState == 1);
activeStatusChanged = true;
}
}
if (f2KeyState != 0 && !charStats->isBg1TomesUsed())
{
charStats->setBg1TomesUsed(true);
system("cls");
UpdateStats(processHandle, memoryAddress, charStats, stats, true);
AddBG1TomeStats(processHandle, memoryAddress, charStats->getStrength(), charStats->getDexterity(), charStats->getConstitution(), charStats->getIntelligence(), charStats->getWisdom(), charStats->getCharisma());
UpdateStats(processHandle, memoryAddress, charStats, stats, false);
PrintStats(charStats, storedCharStats, stats);
}
if (f5KeyState != 0)
{
UpdateMouseCoord(windowHandle, store_btn_coord);
}
if (f6KeyState != 0)
{
UpdateMouseCoord(windowHandle, recall_btn_coord);
}
if (f7KeyState != 0)
{
UpdateMouseCoord(windowHandle, reroll_btn_coord);
}
if (f8KeyState != 0)
{
storedCharStats->reset();
system("cls");
PrintStats(charStats, storedCharStats, stats);
}
}
示例5: main
int main(const int argc, const char *argv[]) {
int nextarg;
NaClLogModuleInit();
NaClLogSetVerbosity(LOG_FATAL);
if (0 != setvbuf(stdout, g_standard_output_buffer, _IOLBF,
sizeof g_standard_output_buffer)) {
NaClLog(LOG_FATAL, "vdiff: setvbuf failed\n");
}
#if NACL_LINUX || NACL_OSX
srandom(time(NULL));
#endif
VDiffInitializeAvailableDecoders();
nextarg = ParseArgv(argc, argv);
if (nextarg == argc) {
if (gPrefix == 0) RunRegressionTests();
TestAllInstructions();
} else {
int i;
gVerbose = TRUE;
for (i = nextarg; i < argc; ++i) {
TestOneInstruction(argv[i]);
}
}
PrintStats();
/* exit with non-zero error code if there were errors. */
exit(gVDiffStats.errors != 0);
}
示例6: GetSavePath
/*******************************************************************
* Function Name: PrintStats
* Return Type : int
* Created On : Oct 27, 2013
* Created By : hrushi
* Comments : Prints the Mean, Median, Standard Dev. the EM Score
* Arguments :
*******************************************************************/
int GroundTruth::PrintStats( const Args& args ) const
{
vector<double> AllScoreVal;
string ScoreSavePath = GetSavePath( args );
cout << "Saving to: " << ScoreSavePath << endl;
cv::FileStorage fScore;
fScore.open(ScoreSavePath, cv::FileStorage::WRITE);
AllScoreVal.reserve(m_vScores.size());
for( auto ClassName : RGN_TYPES )
{
vector<double> ClassScoreVal;
for(const auto& val : m_vScores )
{
AllScoreVal.push_back( val.second );
ClassScoreVal.push_back( val.second );
}
PrintAllVals(args, fScore, ClassName, ClassScoreVal);
}
fScore.release();
PrintStats(args, AllScoreVal);
return EXIT_SUCCESS;
}
示例7: ReadDirToVectorOfUnits
void Fuzzer::RereadOutputCorpus() {
if (Options.OutputCorpus.empty()) return;
std::vector<Unit> AdditionalCorpus;
ReadDirToVectorOfUnits(Options.OutputCorpus.c_str(), &AdditionalCorpus,
&EpochOfLastReadOfOutputCorpus);
if (Corpus.empty()) {
Corpus = AdditionalCorpus;
return;
}
if (!Options.Reload) return;
if (Options.Verbosity >= 2)
Printf("Reload: read %zd new units.\n", AdditionalCorpus.size());
for (auto &X : AdditionalCorpus) {
if (X.size() > (size_t)Options.MaxLen)
X.resize(Options.MaxLen);
if (UnitHashesAddedToCorpus.insert(Hash(X)).second) {
CurrentUnit.clear();
CurrentUnit.insert(CurrentUnit.begin(), X.begin(), X.end());
if (RunOne(CurrentUnit)) {
Corpus.push_back(X);
if (Options.Verbosity >= 1)
PrintStats("RELOAD");
}
}
}
}
示例8: ReadDirToVectorOfUnits
void Fuzzer::RereadOutputCorpus(size_t MaxSize) {
if (Options.OutputCorpus.empty())
return;
std::vector<Unit> AdditionalCorpus;
ReadDirToVectorOfUnits(Options.OutputCorpus.c_str(), &AdditionalCorpus,
&EpochOfLastReadOfOutputCorpus, MaxSize);
if (Corpus.empty()) {
Corpus = AdditionalCorpus;
return;
}
if (!Options.Reload)
return;
if (Options.Verbosity >= 2)
Printf("Reload: read %zd new units.\n", AdditionalCorpus.size());
for (auto &X : AdditionalCorpus) {
if (X.size() > MaxSize)
X.resize(MaxSize);
if (UnitHashesAddedToCorpus.insert(Hash(X)).second) {
if (RunOne(X)) {
Corpus.push_back(X);
UpdateCorpusDistribution();
PrintStats("RELOAD");
}
}
}
}
示例9: ShuffleCorpus
// Finds minimal number of units in 'Extra' that add coverage to 'Initial'.
// We do it by actually executing the units, sometimes more than once,
// because we may be using different coverage-like signals and the only
// common thing between them is that we can say "this unit found new stuff".
UnitVector Fuzzer::FindExtraUnits(const UnitVector &Initial,
const UnitVector &Extra) {
UnitVector Res = Extra;
size_t OldSize = Res.size();
for (int Iter = 0; Iter < 10; Iter++) {
ShuffleCorpus(&Res);
ResetCoverage();
for (auto &U : Initial)
RunOne(U);
Corpus.clear();
for (auto &U : Res)
if (RunOne(U))
Corpus.push_back(U);
char Stat[7] = "MIN ";
Stat[3] = '0' + Iter;
PrintStats(Stat);
size_t NewSize = Corpus.size();
assert(NewSize <= OldSize);
Res.swap(Corpus);
if (NewSize + 5 >= OldSize)
break;
OldSize = NewSize;
}
return Res;
}
示例10: PrintStats
///=====================================================
///
///=====================================================
SignpostMemoryManager::~SignpostMemoryManager() {
#ifndef NDEBUG
m_criticalSection.Enter();
delete m_allocationTracking;
m_allocationTracking = nullptr;
m_criticalSection.Exit();
#endif
PrintStats();
if (firstSignpost->m_next != nullptr) {
__debugbreak();
}
if (firstSignpost->m_prev != nullptr) {
__debugbreak();
}
if (firstSignpost->m_isFree != true) {
__debugbreak();
}
if (firstSignpost->m_size != m_size - sizeof(Signpost)) {
__debugbreak();
}
free(m_buffer);
ConsolePrintf("\nSUCCESSFULLY SHUTDOWN MEMORY MANAGER\n\n");
}
示例11: LoopTransfer
static void LoopTransfer()
{
printf("* Loop Transfers -- reading & writing alternately.\n");
T_0 = time(NULL); // starting time
while (dwRC == USBIO_ERR_SUCCESS)
{
static DWORD n = 0;
// First we get the length (+ the packet size)
GetLength();
if (dwRC == USBIO_ERR_SUCCESS)
{
// Then we read 'Length' bytes
ReadData();
}
if (dwRC == USBIO_ERR_SUCCESS)
{
// Now we send the received data back to the client.
WriteData();
}
if (dwRC == USBIO_ERR_SUCCESS)
{
// Finally, sometimes we print some statistics
if (TransferMode == ELoopDebug)
PrintStatsEveryLoop();
else if ((++n % KLoopModeDisplayUpdate) == 0)
PrintStats();
}
}
}
示例12: NET_Stats_f
static void NET_Stats_f (void)
{
qsocket_t *s;
if (Cmd_Argc () == 1)
{
Con_Printf("unreliable messages sent = %i\n", unreliableMessagesSent);
Con_Printf("unreliable messages recv = %i\n", unreliableMessagesReceived);
Con_Printf("reliable messages sent = %i\n", messagesSent);
Con_Printf("reliable messages received = %i\n", messagesReceived);
Con_Printf("packetsSent = %i\n", packetsSent);
Con_Printf("packetsReSent = %i\n", packetsReSent);
Con_Printf("packetsReceived = %i\n", packetsReceived);
Con_Printf("receivedDuplicateCount = %i\n", receivedDuplicateCount);
Con_Printf("shortPacketCount = %i\n", shortPacketCount);
Con_Printf("droppedDatagrams = %i\n", droppedDatagrams);
}
else if (Q_strcmp(Cmd_Argv(1), "*") == 0)
{
for (s = net_activeSockets; s; s = s->next)
PrintStats(s);
for (s = net_freeSockets; s; s = s->next)
PrintStats(s);
}
else
{
for (s = net_activeSockets; s; s = s->next)
{
if (q_strcasecmp(Cmd_Argv(1), s->address) == 0)
break;
}
if (s == NULL)
{
for (s = net_freeSockets; s; s = s->next)
{
if (q_strcasecmp(Cmd_Argv(1), s->address) == 0)
break;
}
}
if (s == NULL)
return;
PrintStats(s);
}
}
示例13: myAliveCheck
MemPoolDebug::~MemPoolDebug()
{
myAliveCheck();
if (myVerbosityLevel > 0) LogStream() << "[Log] MemPoolDebug(\"" << myName << "\"): dtor commencing" << endl;
if (myInUseCount != 0) DtorErrorMesg();
if (myVerbosityLevel > 0) PrintStats();
if (myVerbosityLevel > 0) LogStream() << "[Log] MemPoolDebug(\"" << myName << "\"): dtor completed" << endl;
myAliveOrDead = ~AliveMark; // Useful telltale for debugging
}
示例14: PrintStats
void Fuzzer::PrintStatusForNewUnit(const Unit &U) {
if (!Options.PrintNEW)
return;
PrintStats("NEW ", "");
if (Options.Verbosity) {
Printf(" L: %zd ", U.size());
MD.PrintMutationSequence();
Printf("\n");
}
}
示例15: TakeAShot
void TakeAShot(CS170::WarBoats::Ocean &ocean, const CS170::WarBoats::Point& pt)
{
CS170::WarBoats::ShotResult sr;
std::cout << "Shot: " << pt.x << ", " << pt.y << " ";
sr = CS170::WarBoats::TakeShot(ocean, pt);
PrintShotResult(sr);
PrintStats(GetShotStats(ocean));
CS170::WarBoats::DumpOcean(ocean);
std::cout << std::endl;
}