Made display changes more responsive.

This commit is contained in:
pdw
2002-04-01 21:22:20 +00:00
parent bb3619b3fc
commit 57afc62a3a
4 changed files with 70 additions and 48 deletions

10
iftop.c
View File

@@ -87,7 +87,7 @@ void history_rotate() {
}
void tick() {
void tick(int print) {
time_t t;
pthread_mutex_lock(&tick_mutex);
@@ -95,10 +95,14 @@ void tick() {
t = time(NULL);
if(t - last_timestamp >= RESOLUTION) {
//printf("TICKING\n");
analyse_data();
ui_print();
history_rotate();
last_timestamp = t;
}
else if(print) {
ui_print();
}
pthread_mutex_unlock(&tick_mutex);
}
@@ -115,7 +119,7 @@ static void handle_packet(char* args, const struct pcap_pkthdr* pkthdr,const cha
int direction = 0; /* incoming */
eptr = (struct ether_header*)packet;
tick();
tick(0);
if(ntohs(eptr->ether_type) == ETHERTYPE_IP) {
struct ip* iptr;
@@ -285,6 +289,8 @@ int main(int argc, char **argv) {
init_history();
ui_init();
pthread_create(&thread, NULL, (void*)&packet_loop, NULL);
ui_loop();