darxtrix / ptop

An awesome task manager written in python. :computer:

Home Page:http://darxtrix.in/ptop/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add network stats

darxtrix opened this issue · comments

Add incoming and outgoing bandwidth to ptop

The following psutil methods can be used.

  1. .net_io_counters()
  2. .net_if_addrs()

Network Stats can be added using psutil.net_io_counters() by which we can display the bytes sent and received in the ptop monitor.

net = psutil.net_io_counters()
sentt = net[0]*0.000001
sentt = str(round(sentt,2))
recc = net[1]*0.000001
recc = str(round(recc,2))
row4 = "Network Usage:\nSent/Received {4}{0: <7}/{1: >7} MB{4}{2: >2} {5} {4}{3<8}".format(sentt,
recc,
'',
'',
" "int(4self.X_SCALING_FACTOR),
" "int(9self.X_SCALING_FACTOR))

Hi Smeet, Thanks for the code snippet. Actually, I have a plan to not show users raw stats in numbers but to have a bar graph also by using a module https://github.com/darxtrix/lehar that i wrote for this purpose.

@smeet20 Skipping the graph for now, fixed by #50