Giter Site home page Giter Site logo

pst's Introduction

Hi there, I'm Mike 👋

  • 🌎 I’m a web developer from the United States
  • ❤ Contributing to Open Source.
  • 🐍 I specialize in Python and Django, but my programming experience extends across multiple languages and tools
  • ✍ I write technical blogs. You can visit my blog site at DEV.
  • 💬 Ask me about optimizing web app performance for scalability
  • ⚡ Fun fact: Before using Git, I worked with various version control systems including Mercurial, SVN, CVS, and Perforce

Blog posts 📰

Contact 📫

Let's collaborate! Reach out via email at [email protected] 💼💻

pst's People

Contributors

topunix avatar

Watchers

 avatar

pst's Issues

not giving correct process tree

The tree given by pst.py does not correspond to process tree

ps -e -o pid,ppid,args
  PID  PPID COMMAND
    1     0 /init
    6     1 /init
    7     6 /init
    8     7 -bash
  473     8 sleep 3000
  474     8 ps -e -o pid,ppid,args

$ pstree -spa
init,1
  ├─init,6
  │   └─init,7
  │       └─bash,8
  │           ├─pstree,475 -spa
  │           └─sleep,473 3000
  └─{init},5

$ ./pst.py -w
  PID  COMMAND
    1  /init
    6   \_ /init
    7   \_ /init
    8           \_ -bash
  476               \_ python ./pst.py -w
  477                   \_ ps -e l
  473                       \_ sleep 3000    <= father is 8 not 477

not working as expected when ppid greater than pid

When child pid less than its parent, the ps command will display child before parent (see 375 1051 bash line in example)

it seems bad supposition in format_process_trees :

# Parent always comes before child
# ps -ef -o pid,ppid,args
  PID  PPID COMMAND
    1     0 /init
    6     1 /init
    7     6 /init
    8     7 -bash
  375  1051 bash
  383   375 bash
  396   383 ps -e -o pid,ppid,args
  636     1 /init
  637   636 /init
  638   637 -bash
 1011     8 bash
 1019  1011 bash
 1027  1019 bash
 1035  1027 bash
 1051  1035 bash

# ./pst.py -w
  PID  COMMAND
    1  /init
    6   \_ /init
    7   \_ /init
    8   |       \_ -bash
 1011   |           \_ bash
 1019   |               \_ bash
 1027   |                   \_ bash
 1035   |                       \_ bash
 1051   |                           \_ bash
  636   \_ /init
  637   \_ /init
  638           \_ -bash
  375  bash                                 <====== is child of 1051 !
  383   \_ bash
  392   \_ python ./pst.py -w
  393           \_ ps -e l

# pstree -ap
init,1
  ├─init,6
  │   └─init,7
  │       └─bash,8
  │           └─bash,1011
  │               └─bash,1019
  │                   └─bash,1027
  │                       └─bash,1035
  │                           └─bash,1051
  │                               └─bash,375
  │                                   └─bash,383
  │                                       └─pstree,407 -ap
  ├─init,636
  │   └─init,637
  │       └─bash,638
  └─{init},5

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.