Merge pull request #2 from luke-jr/vt100
Bugfix: Use ANSI/VT100 codes to update status line in a way that actually works
This commit is contained in:
commit
2bdc3acde2
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*) {
|
extern "C" void* ThreadStats(void*) {
|
||||||
|
bool first = true;
|
||||||
do {
|
do {
|
||||||
char c[256];
|
char c[256];
|
||||||
time_t tim = time(NULL);
|
time_t tim = time(NULL);
|
||||||
|
@ -304,7 +305,14 @@ extern "C" void* ThreadStats(void*) {
|
||||||
strftime(c, 256, "[%y-%m-%d %H:%M:%S]", tmp);
|
strftime(c, 256, "[%y-%m-%d %H:%M:%S]", tmp);
|
||||||
CAddrDbStats stats;
|
CAddrDbStats stats;
|
||||||
db.GetStats(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 requests = 0;
|
||||||
uint64_t queries = 0;
|
uint64_t queries = 0;
|
||||||
for (unsigned int i=0; i<dnsThread.size(); i++) {
|
for (unsigned int i=0; i<dnsThread.size(); i++) {
|
||||||
|
|
Loading…
Reference in a new issue