Giter VIP home page Giter VIP logo

ptop's People

Contributors

bryant1410 avatar darxtrix avatar dependabot[bot] avatar livibetter avatar sdeepaknarayanan avatar vinusankars avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ptop's Issues

Can't install ptop on CentOS 7

Hi,

I am trying to install ptop on CentOS 7 without success.
The error I am getting is:

psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python2 -u -c "import setuptools, tokenize;file='/tmp/pip-install-aKSv9b/psutil/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-XEO958/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-aKSv9b/psutil/

I understand that it says I need Python.h but there is no one. With what should it be comming?

EDIT: I have tried with yum install python34-devel but I get the same error.

New GUI can be drawn in terminal in case of terminal resizing

Listen for CMD + & CMD - and resize the app (stop the old app and redraw the form again). One more thing can be checked is horizontal vs vertical scaling. How it can fit in ?

Case 1 - Font resizing

Font changing in terminal(before & after rendering)

Scrolling can be an option ?

Tested with drawille, yes the terminal size changes with CMD+ and CMD- not only the font size is increased.

Case 2 - Terminal window resizing
This can be handled easily by checking change in terminal window sizing and then redrawing the GUI.

Solution => Keep listening for the size of the terminal and re-draw.
This will be also helpful

https://groups.google.com/forum/#!msg/npyscreen/anab-NQC_IY/8J4HeQJ-XCQJ;context-place=forum/npyscreen & resizing logic at http://npyscreen.readthedocs.io/form-objects.html

Killing chrome making ptop hung up

  • Add some logging to check whether not able to kill
  • Try killing from command line may be an option
  • Check why it is getting stuck the UI

Optimize the sorting behavior

See if there is any scope of optimizing the sorting behavior.

  • We don't have to sort each time the processes list, I guess we can use an index for the relevance sort. But for this also we have to get all the process ids that are active and add new process ids and remove all the old process ids from the index. And then display the sorted processes using the index and the process hash map.

Will not die when wrong theme is being loaded

$ ptop -t 232323
Traceback (most recent call last):
  File "/usr/bin/ptop", line 9, in <module>
    load_entry_point('ptop==0.0.6', 'console_scripts', 'ptop')()
  File "/usr/lib/python2.7/site-packages/ptop/main.py", line 48, in main
    app.run()
  File "/usr/lib/python2.7/site-packages/npyscreen/apNPSApplication.py", line 30, in run
    return npyssafewrapper.wrapper(self.__remove_argument_call_main)
  File "/usr/lib/python2.7/site-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
    wrapper_no_fork(call_function)
  File "/usr/lib/python2.7/site-packages/npyscreen/npyssafewrapper.py", line 97, in wrapper_no_fork
    return_code = call_function(_SCREEN)    
  File "/usr/lib/python2.7/site-packages/npyscreen/apNPSApplication.py", line 25, in __remove_argument_call_main
    return self.main()
  File "/usr/lib/python2.7/site-packages/ptop/interfaces/GUI.py", line 239, in main
    npyscreen.setTheme(self.get_theme())
  File "/usr/lib/python2.7/site-packages/ptop/interfaces/GUI.py", line 118, in get_theme
    return self.themes[self.arg]
KeyError: '232323'

Ctrl+c doesn't work, nothing does, you need to restart the terminal entirely.

Updater doesn't consistently work

I don't have python2 installed so calling python in my terminal returns command not found. To start python, I need to call python3. I needed to change

update_success_status |= os.system('cd /tmp/{0}/ && sudo python setup.py install'.format(source_folder))

to this:

update_success_status |= os.system('cd /tmp/{0}/ && sudo python3 setup.py install'.format(source_folder))

to get the program to update correctly. (these edits are on main.py)

Possible solution:
use sys.version to get the version of python that is currently running and use the proper command

No module named '_curses'

I got this error after I called ptop

PS C:\\> ptop
Traceback (most recent call last):
  File "C:\Python39\Scripts\ptop-script.py", line 33, in <module>
    sys.exit(load_entry_point('ptop==1.1', 'console_scripts', 'ptop')())
  File "C:\Python39\Scripts\ptop-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "C:\Python39\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "C:\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "C:\Python39\lib\site-packages\ptop-1.1-py3.9.egg\ptop\main.py", line 13, in <module>
    from ptop.interfaces import PtopGUI
  File "C:\Python39\lib\site-packages\ptop-1.1-py3.9.egg\ptop\interfaces\__init__.py", line 1, in <module>
    from .GUI import PtopGUI
  File "C:\Python39\lib\site-packages\ptop-1.1-py3.9.egg\ptop\interfaces\GUI.py", line 6, in <module>
    import npyscreen, math, drawille
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Python39\lib\site-packages\npyscreen-4.10.5-py3.9.egg\npyscreen\__init__.py", line 5, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "C:\Python39\lib\site-packages\npyscreen-4.10.5-py3.9.egg\npyscreen\wgwidget.py", line 5, in <module>
  File "C:\Python39\lib\curses\__init__.py", line 13, in <module>
    from _curses import *
ModuleNotFoundError: No module named '_curses'

windows 10
python 3

so whats worng?

Flickering, especially in byobu.

I'm running ptop on a:

2011 Macbook Pro 16GB RAM
running in Mac terminal.app
vagrant ssh

Minimised the issue by customising the CPU refresh time to 2000 with -csrt 2000

Great job with it so far, though.

Always an Update

Ptop asks me to update every time I run it.

samy-mbp-5:~ samybencherif$ ptop
A new version is available, would you like to update (Y/N) ? Y

Creating a temporary directory /tmp/FVZWD0INN0 ...
Cloning into '/tmp/FVZWD0INN0'...
remote: Enumerating objects: 88, done.
remote: Counting objects: 100% (88/88), done.
remote: Compressing objects: 100% (59/59), done.
remote: Total 784 (delta 43), reused 65 (delta 26), pack-reused 696
Receiving objects: 100% (784/784), 9.35 MiB | 1.16 MiB/s, done.
Resolving deltas: 100% (374/374), done.

Installing ptop ...
[ ... ]
Using /Library/Python/2.7/site-packages
Finished processing dependencies for ptop==1.1

samy-mbp-5:~ samybencherif$ ptop
A new version is available, would you like to update (Y/N) ?

However after running the update, I am in fact not updated.

samy-mbp-5:~ samybencherif$ ptop -v
ptop 1.0

For anyone else experiencing this issue it can be temporarily patched by disabling the updater altogether.

curl -L https://bit.ly/2KBDt9y | python3 -
^ run at your own discretion

suggestion: select default theme to run

if I quickly want to check consumption it doesn't seem fun to have to type out -t ... each time, so either select a default theme globally, or set a way for a user to define their choice them for subsequent runs would be great so can just initialize with ptop

Show the most relevant processes first.

Showing long running processes in the process table is of no use to the user coz user will be less probable to check their stats, better would be to make the default list of process to be sorted by up time of processes.

Feature Storming

Add the following features:

  1. Show ports information for a particular process
    Search by ports will also be there as the current search searches in the whole process line.

  2. Kill and restart option

ptop is the name of another program so won['t launch

I installed ptop in ubuntu successfully through pip. However when you try to launch ptop it can't find it because the terminal / system believes you're trying to launch a program called ptop in the repositories and suggests installing it with apt-get... it's an entirely different program

so how can i run ptop? is there a direct command i can use?

Kill ptop properly

Observation 1:

In case any exception occurs, an exception should be logged properly and ptop should be killed properly will all of the threads ( gui and sensor threads ) killed properly. For eg. in case, the GUI cannot be drawn properly exception occurs and ptop hangs.

Observation 2:

While killing ptop, catch the kill signals properly and kill all the threads.

The Encoding Problem

image
I coming from china.I use secureCRT to login in my Cloud Computer and try to use the PTOP.but it show the info as the above picture.

Proposing a PR to fix a few small typos

Issue Type

[x] Bug (Typo)

Steps to Replicate and Expected Behaviour

  • Examine ptop/interfaces/GUI.py and observe reponsive, however expect to see responsive.
  • Examine ptop/plugins/process_sensor.py and observe privelages, however expect to see privileges.
  • Examine ptop/constants.py and observe overriden, however expect to see overridden.
  • Examine ptop/core/plugin.py and observe overrided, however expect to see overridden.
  • Examine telemetry.js and observe enteries, however expect to see entries.
  • Examine README.md and observe compaible, however expect to see compatible.
  • Examine ptop/interfaces/GUI.py and observe chossing, however expect to see choosing.
  • Examine ptop/interfaces/GUI.py and observe beacuse, however expect to see because.
  • Examine ptop/plugins/process_sensor.py and observe adminstrator, however expect to see administrator.

Notes

Semi-automated issue generated by
https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

To avoid wasting CI processing resources a branch with the fix has been
prepared but a pull request has not yet been created. A pull request fixing
the issue can be prepared from the link below, feel free to create it or
request @timgates42 create the PR. Alternatively if the fix is undesired please
close the issue with a small comment about the reasoning.

https://github.com/timgates42/ptop/pull/new/bugfix_typos

Thanks.

Add config options.

Commandline configuration options to set different themes that are supported by npyscreen

Separate out the hardcoding from GUI.py

All of the positions, lengths, widths are hardcoded. Need to separate them in a different config file or in the same file.

Take into account the situations in which the Terminal screen is quite small. The following strategy can be used.

  • Ptop can try to be responsive till a particular stage
  • After that the user can do scrolling to see the full view.

Enhance search functionality

Two things we can add:

  • When pressing l ptop prompts for search box but it gets overridden in the current behavior, this should me made functional for process sorting
  • User should be able to pin processes to the process table for next runs

One more observation, pressing l makes q useless ..^ + q can be used I guess.

This will help in implementing the search functionality https://github.com/npcole/npyscreen/blob/d286599d63de599a7df1e6e75367d1928a1b0ccf/npyscreen/wgmultiline.py

When the search action is fired there should be a way to keep the search pop up attached to the display in case the update function is fired through the thread job in background

Just thinking
Do I really need a thread job here for updating the UI ? I know while_waiting is getting called anyway from the logs why do i need a thread job then

Use a good logging mechanism

I am not able to see the logs in the .ptop.log file.

A better way would be make a directory named .ptop and add separate log files under it. For the sake of preventing memory flooding, we have to have some cycling/cleaning mechanism of log files.

Need to see what are the best practices for usage of logging module.

Observations

  • Current behavior is that only INFO level logs are made to the log file and upon termination/quitting of ptop the log file is erased.

Separate the keyboard shortcuts in some config file

The keyboard shortcuts should be separated in some config file because the current ones' may interfere with the user bindings. Also, in this case we also need to handle the rendering of the shortcuts from the config file.

After killing terminal misbehaviour

After killing ptop, the terminal displays text "ble, would you like to update (Y/N) ?"
It is not responsive to input and keeps on happening after every kill.
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.