Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: third_party/psutil/examples/disk_usage.py

Issue 8919026: Remove psutil from tree, install via install-build-deps.sh (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sort package list. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/psutil/docs/milestones.lnk.html ('k') | third_party/psutil/examples/iotop.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/psutil/examples/disk_usage.py
diff --git a/third_party/psutil/examples/disk_usage.py b/third_party/psutil/examples/disk_usage.py
deleted file mode 100644
index 23f2d0c3f17118fe0d3b97df39ba0f35060d3eb1..0000000000000000000000000000000000000000
--- a/third_party/psutil/examples/disk_usage.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-#
-# $Id: disk_usage.py 1143 2011-10-05 19:11:59Z g.rodola $
-#
-# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""
-List all mounted disk partitions a-la "df -h" command.
-"""
-
-import sys
-import psutil
-
-def convert_bytes(n):
- if n == 0:
- return "0B"
- symbols = ('k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
- prefix = {}
- for i, s in enumerate(symbols):
- prefix[s] = 1 << (i+1)*10
- for s in reversed(symbols):
- if n >= prefix[s]:
- value = float(n) / prefix[s]
- return '%.1f%s' % (value, s)
-
-
-def main():
- templ = "%-17s %8s %8s %8s %5s%% %9s %s"
- print templ % ("Device", "Total", "Used", "Free", "Use ", "Type", "Mount")
- for part in psutil.disk_partitions(all=False):
- usage = psutil.disk_usage(part.mountpoint)
- print templ % (part.device,
- convert_bytes(usage.total),
- convert_bytes(usage.used),
- convert_bytes(usage.free),
- int(usage.percent),
- part.fstype,
- part.mountpoint)
-
-if __name__ == '__main__':
- sys.exit(main())
« no previous file with comments | « third_party/psutil/docs/milestones.lnk.html ('k') | third_party/psutil/examples/iotop.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698