|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 28, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "# Get file size distribution\n", |
| 10 | + "import sys\n", |
| 11 | + "import os\n", |
| 12 | + "import pandas as pd\n", |
| 13 | + "\n", |
| 14 | + "dictFileStats = {}\n", |
| 15 | + "from os.path import join, getsize\n", |
| 16 | + "\n", |
| 17 | + "if len(sys.argv) == 2:\n", |
| 18 | + " rootDir = sys.argv[1]\n", |
| 19 | + "else:\n", |
| 20 | + " rootDir = '/root/throwaway/linux-4.16.12'\n", |
| 21 | + "\n", |
| 22 | + "for root, dirs, files in os.walk(rootDir):\n", |
| 23 | + " for name in files:\n", |
| 24 | + " filePath = join(root,name)\n", |
| 25 | + " dictFileStats[filePath] = getsize(filePath)\n", |
| 26 | + "\n" |
| 27 | + ] |
| 28 | + }, |
| 29 | + { |
| 30 | + "cell_type": "code", |
| 31 | + "execution_count": 29, |
| 32 | + "metadata": {}, |
| 33 | + "outputs": [], |
| 34 | + "source": [ |
| 35 | + "ser_fileSizes = pd.Series(dictFileStats)" |
| 36 | + ] |
| 37 | + }, |
| 38 | + { |
| 39 | + "cell_type": "code", |
| 40 | + "execution_count": 30, |
| 41 | + "metadata": {}, |
| 42 | + "outputs": [ |
| 43 | + { |
| 44 | + "data": { |
| 45 | + "text/plain": [ |
| 46 | + "/root/throwaway/linux-4.16.12/.cocciconfig 59\n", |
| 47 | + "/root/throwaway/linux-4.16.12/.get_maintainer.ignore 31\n", |
| 48 | + "/root/throwaway/linux-4.16.12/.gitattributes 30\n", |
| 49 | + "/root/throwaway/linux-4.16.12/.gitignore 1571\n", |
| 50 | + "/root/throwaway/linux-4.16.12/.mailmap 9142\n", |
| 51 | + "/root/throwaway/linux-4.16.12/COPYING 18693\n", |
| 52 | + "/root/throwaway/linux-4.16.12/CREDITS 98556\n", |
| 53 | + "/root/throwaway/linux-4.16.12/Documentation/.gitignore 13\n", |
| 54 | + "/root/throwaway/linux-4.16.12/Documentation/00-INDEX 15136\n", |
| 55 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/README 3821\n", |
| 56 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-bus-usb 1296\n", |
| 57 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-arvo 2892\n", |
| 58 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-isku 8101\n", |
| 59 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-koneplus 8003\n", |
| 60 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-konepure 5616\n", |
| 61 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-kovaplus 6315\n", |
| 62 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-lua 372\n", |
| 63 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra 6376\n", |
| 64 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-ryos 9380\n", |
| 65 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-savu 4062\n", |
| 66 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-firmware-acpi 384\n", |
| 67 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/obsolete/sysfs-gpio 1325\n", |
| 68 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/removed/devfs 471\n", |
| 69 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/removed/dv1394 664\n", |
| 70 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/removed/ip_queue 310\n", |
| 71 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/removed/net_dma 339\n", |
| 72 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/removed/o2cb 449\n", |
| 73 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/removed/raw1394 663\n", |
| 74 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/removed/sysfs-class-rfkill 488\n", |
| 75 | + "/root/throwaway/linux-4.16.12/Documentation/ABI/removed/video1394 751\n", |
| 76 | + " ... \n", |
| 77 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/pmu.c 15373\n", |
| 78 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/psci.c 12107\n", |
| 79 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/trace.h 6258\n", |
| 80 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/trace.h 884\n", |
| 81 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-debug.c 6555\n", |
| 82 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-init.c 13748\n", |
| 83 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-irqfd.c 3310\n", |
| 84 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-its.c 66206\n", |
| 85 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-kvm-device.c 15907\n", |
| 86 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-mmio-v2.c 13364\n", |
| 87 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-mmio-v3.c 25775\n", |
| 88 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-mmio.c 21850\n", |
| 89 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-mmio.h 6982\n", |
| 90 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-v2.c 12489\n", |
| 91 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-v3.c 16662\n", |
| 92 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic-v4.c 10672\n", |
| 93 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic.c 24860\n", |
| 94 | + "/root/throwaway/linux-4.16.12/virt/kvm/arm/vgic/vgic.h 9698\n", |
| 95 | + "/root/throwaway/linux-4.16.12/virt/kvm/async_pf.c 5968\n", |
| 96 | + "/root/throwaway/linux-4.16.12/virt/kvm/async_pf.h 1126\n", |
| 97 | + "/root/throwaway/linux-4.16.12/virt/kvm/coalesced_mmio.c 4251\n", |
| 98 | + "/root/throwaway/linux-4.16.12/virt/kvm/coalesced_mmio.h 884\n", |
| 99 | + "/root/throwaway/linux-4.16.12/virt/kvm/eventfd.c 23043\n", |
| 100 | + "/root/throwaway/linux-4.16.12/virt/kvm/irqchip.c 6280\n", |
| 101 | + "/root/throwaway/linux-4.16.12/virt/kvm/kvm_main.c 97591\n", |
| 102 | + "/root/throwaway/linux-4.16.12/virt/kvm/vfio.c 9110\n", |
| 103 | + "/root/throwaway/linux-4.16.12/virt/kvm/vfio.h 289\n", |
| 104 | + "/root/throwaway/linux-4.16.12/virt/lib/Kconfig 36\n", |
| 105 | + "/root/throwaway/linux-4.16.12/virt/lib/Makefile 48\n", |
| 106 | + "/root/throwaway/linux-4.16.12/virt/lib/irqbypass.c 6116\n", |
| 107 | + "Length: 62908, dtype: int64" |
| 108 | + ] |
| 109 | + }, |
| 110 | + "execution_count": 30, |
| 111 | + "metadata": {}, |
| 112 | + "output_type": "execute_result" |
| 113 | + } |
| 114 | + ], |
| 115 | + "source": [ |
| 116 | + "ser_fileSizes" |
| 117 | + ] |
| 118 | + }, |
| 119 | + { |
| 120 | + "cell_type": "code", |
| 121 | + "execution_count": 38, |
| 122 | + "metadata": {}, |
| 123 | + "outputs": [ |
| 124 | + { |
| 125 | + "name": "stdout", |
| 126 | + "output_type": "stream", |
| 127 | + "text": [ |
| 128 | + "count 6.290800e+04\n", |
| 129 | + "mean 1.248228e+04\n", |
| 130 | + "std 9.156178e+04\n", |
| 131 | + "min 0.000000e+00\n", |
| 132 | + "25% 1.382000e+03\n", |
| 133 | + "50% 3.973500e+03\n", |
| 134 | + "75% 1.122200e+04\n", |
| 135 | + "max 1.415147e+07\n", |
| 136 | + "dtype: float64\n" |
| 137 | + ] |
| 138 | + } |
| 139 | + ], |
| 140 | + "source": [ |
| 141 | + "print (ser_fileSizes.describe())" |
| 142 | + ] |
| 143 | + }, |
| 144 | + { |
| 145 | + "cell_type": "code", |
| 146 | + "execution_count": 36, |
| 147 | + "metadata": {}, |
| 148 | + "outputs": [], |
| 149 | + "source": [ |
| 150 | + "\n" |
| 151 | + ] |
| 152 | + }, |
| 153 | + { |
| 154 | + "cell_type": "code", |
| 155 | + "execution_count": 39, |
| 156 | + "metadata": {}, |
| 157 | + "outputs": [ |
| 158 | + { |
| 159 | + "name": "stdout", |
| 160 | + "output_type": "stream", |
| 161 | + "text": [ |
| 162 | + "[62900 3 1 0 2 0 0 0 0 2]\n" |
| 163 | + ] |
| 164 | + } |
| 165 | + ], |
| 166 | + "source": [ |
| 167 | + "print (count)" |
| 168 | + ] |
| 169 | + }, |
| 170 | + { |
| 171 | + "cell_type": "code", |
| 172 | + "execution_count": null, |
| 173 | + "metadata": {}, |
| 174 | + "outputs": [], |
| 175 | + "source": [] |
| 176 | + } |
| 177 | + ], |
| 178 | + "metadata": { |
| 179 | + "kernelspec": { |
| 180 | + "display_name": "Python 3", |
| 181 | + "language": "python", |
| 182 | + "name": "python3" |
| 183 | + }, |
| 184 | + "language_info": { |
| 185 | + "codemirror_mode": { |
| 186 | + "name": "ipython", |
| 187 | + "version": 3 |
| 188 | + }, |
| 189 | + "file_extension": ".py", |
| 190 | + "mimetype": "text/x-python", |
| 191 | + "name": "python", |
| 192 | + "nbconvert_exporter": "python", |
| 193 | + "pygments_lexer": "ipython3", |
| 194 | + "version": "3.6.5" |
| 195 | + } |
| 196 | + }, |
| 197 | + "nbformat": 4, |
| 198 | + "nbformat_minor": 2 |
| 199 | +} |
0 commit comments