Bugfix: Use ANSI/VT100 codes to update status line in a way that actually works
This commit is contained in:
parent
7cccaba343
commit
ab3edbea18
1 changed files with 9 additions and 1 deletions
10
main.cpp
10
main.cpp
|
@ -297,6 +297,7 @@ extern "C" void* ThreadDumper(void*) {
|
|||
}
|
||||
|
||||
extern "C" void* ThreadStats(void*) {
|
||||
bool first = true;
|
||||
do {
|
||||
char c[256];
|
||||
time_t tim = time(NULL);
|
||||
|
@ -304,7 +305,14 @@ extern "C" void* ThreadStats(void*) {
|
|||
strftime(c, 256, "[%y-%m-%d %H:%M:%S]", tmp);
|
||||
CAddrDbStats stats;
|
||||
db.GetStats(stats);
|
||||
printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
printf("\n\n\n\x1b[3A");
|
||||
}
|
||||
else
|
||||
printf("\x1b[2K\x1b[u");
|
||||
printf("\x1b[s");
|
||||
uint64_t requests = 0;
|
||||
uint64_t queries = 0;
|
||||
for (unsigned int i=0; i<dnsThread.size(); i++) {
|
||||
|
|
Loading…
Reference in a new issue