Commit graph

8 commits

Author SHA1 Message Date
Paul Osborne
fe0ed22080 rustup: update to run on the latest rust nightlies
Signed-off-by: Paul Osborne <osbpau@gmail.com>
2015-05-11 21:41:36 -05:00
Paul Osborne
99b4bdd596 Move to the new std::io APIs for parsing proc files
The implementation is certainly not cleaner to look at.  For whatever
reason, the noticeable delay that was present on startup previously
is now gone, so some performance issue must have been resolved with
this change as well.
2015-03-06 00:25:38 -06:00
Paul Osborne
8d9bf2cefb Use hashmap for O(n) instead of O(n^2) tree building from records 2015-03-05 23:12:32 -06:00
Paul Osborne
5823d36e84 Updates based on code review by @nastevens
This addresses the following feeback:

Your code looks really good, and very Rustic. I only have a few comments:
· In ProcessRecord you use isize for the pid and ppid. These aren’t really sizes, so I’d go with i32
· Line 102: since all you’re doing is panic!() on Err, you can just use .unwrap()
· Line 107: you could use “filter_map” instead of filter and then “collect” the results. This eliminates the need for “mut records” on line 98
· Line 126: use “filter_map”
· I’d add Cargo support
· You could consider using a map type containing vector types for storing the ppid->pid translation. That would improve performance since the record list wouldn’t getting iterated over multiple times. Unfortunately Rust doesn’t have a multimap yet (see https://github.com/rust-lang/rfcs/issues/784), otherwise you could just use that!

Using a map type for the lookup is not supported with this but will
be evaluated.
2015-03-03 23:51:54 -06:00
Paul Osborne
c141feddd8 nightlies: Update code to build/run with latest 1.0.0 compiler 2015-03-03 00:18:02 -06:00
Paul Osborne
9acf97f949 pstree: It works... it actually works!
Lots of learning along the way and realizations that Rust's manual
memory management actually prevents you from doing bad things that
you might otherwise want to do.  Fair enough.  Lots of syntactic struggles
and wishin the language was managed at times.

- / #0
  - init #1
    - upstart-udev-br #295
    - systemd-udevd #303
    - upstart-file-br #391
    - rsyslogd #443
    - dbus-daemon #499
    - upstart-socket- #507
    - ModemManager #579
    - bluetoothd #581
    - systemd-logind #593
    - avahi-daemon #686
      - avahi-daemon #688
    - NetworkManager #777
      - dhclient #1046
      - dnsmasq #1060
    - getty #859
    - getty #863
    - polkitd #899
    - getty #904
    - getty #905
    - getty #908
    - sh #931
      - initctl #944
    - sshd #981
    - kerneloops #1000
    - cron #1006
    - acpid #1018
    - cups-browsed #1023
    - whoopsie #1054
    - VBoxService #1210
    - getty #1276
    - lightdm #1295
      - Xorg #1319
      - lightdm #1340
        - mate-session #1355
          - ssh-agent #1446
          - mate-settings-d #1541
          - marco #1545
            - zenity #8779
          - mate-panel #1549
            - mate-terminal #1864
              - gnome-pty-helpe #1873
              - zsh #1874
                - pstree #15186
                - emacs #13667
                - pstree #15186
              - zsh #7803
            - java #8648
          - caja #1558
          - polkit-mate-aut #1587
          - deja-dup-monito #1589
          - indicator-power #1593
          - indicator-bluet #1594
          - update-notifier #1600
          - zeitgeist-datah #1607
          - nm-applet #1613
          - applet.py #1623
    - accounts-daemon #1305
    - VBoxClient #1423
    - VBoxClient #1431
    - VBoxClient #1436
    - VBoxClient #1441
    - dbus-launch #1450
    - dbus-daemon #1461
    - ibus-daemon #1476
      - ibus-dconf #1493
      - ibus-ui-gtk3 #1494
      - ibus-engine-sim #1570
    - gvfsd #1488
    - ibus-x11 #1498
    - gvfsd-fuse #1503
    - dconf-service #1509
    - gnome-keyring-d #1522
    - at-spi-bus-laun #1528
      - dbus-daemon #1532
    - at-spi2-registr #1535
    - pulseaudio #1561
    - rtkit-daemon #1563
    - gvfs-udisks2-vo #1572
    - udisksd #1581
    - upowerd #1599
    - gvfs-mtp-volume #1630
    - zeitgeist-daemo #1634
    - gvfs-gphoto2-vo #1639
    - gvfs-afc-volume #1671
    - zeitgeist-fts #1708
      - cat #1789
    - wnck-applet #1767
    - notification-ar #1769
    - clock-applet #1771
    - gvfsd-trash #1792
    - gconfd-2 #1798
    - cupsd #1858
    - gvfsd-burn #8225
    - geoclue-master #8247
    - ubuntu-geoip-pr #8251
    - gvfsd-http #8281
    - master #11380
      - qmgr #11383
      - pickup #13717
    - notify-osd #11677
    - gnome-screensav #11715
    - gvfsd-metadata #13196
    - oneconf-service #15144
  - kthreadd #2
    - ksoftirqd/0 #3
    - rcu_sched #7
    - rcuos/0 #8
    - rcuos/1 #9
    - rcu_bh #10
    - rcuob/0 #11
    - rcuob/1 #12
    - migration/0 #13
    - watchdog/0 #14
    - watchdog/1 #15
    - migration/1 #16
    - ksoftirqd/1 #17
    - khelper #20
    - kdevtmpfs #21
    - netns #22
    - writeback #23
    - kintegrityd #24
    - bioset #25
    - kblockd #27
    - ata_sff #28
    - khubd #29
    - md #30
    - devfreq_wq #31
    - khungtaskd #33
    - kswapd0 #34
    - ksmd #35
    - khugepaged #36
    - fsnotify_mark #37
    - ecryptfs-kthrea #38
    - crypto #39
    - kthrotld #51
    - scsi_eh_0 #54
    - scsi_eh_1 #55
    - deferwq #76
    - charger_manager #77
    - scsi_eh_2 #118
    - kpsmoused #122
    - kdmflush #138
    - bioset #139
    - kdmflush #140
    - bioset #141
    - jbd2/dm-0-8 #157
    - ext4-rsv-conver #158
    - ext4-rsv-conver #341
    - iprt #422
    - krfcommd #694
    - kauditd #1345
2014-10-14 03:57:18 -05:00
Paul Osborne
b1fa5a4d58 pstree: lots of fiddling and learning the language
I think I'm starting to 'get it' a bit more.  Rust really forces the
issue with dealing with error types and you kind of need to get deep
into all parts of the language right away to get stuff working; that
being said, the language is reasonable in size and has a relatively
small number of concepts.
2014-10-11 02:58:12 -05:00
Paul Osborne
76204e72df pstree: start to flesh out some basic functionality
Right now, this project is primarily a way to learn rust.  If things
start coming together, there does seem to be some interest in a
library filling the same niche for Rust as psutil does for Python.

For now, however, the goal is to write a simple pstree visualization.
2014-10-09 02:42:29 -05:00