fio_util: Change description and graph name in perf_measurements

We send FIO result perf data to chrome perf dashboard but the
data from same platform with different internal disk (Example:
falco 16G and 32G) get mixed in the same graph which makes
the results to be not meaningful. This patch fixes that by
separate each disk model/size to its own graph.

Also move util to where it should be
- Move fio_util from client/common_lib to client/bin
- Move get_disk_size() from site_utils to base_utils

BUG=chromium:379468
TEST=Run in falco/peach_pit. Get desired result in perf_measurements

Change-Id: I50518ce541cb4b2fc21b67db1bbd5de82ddecc6d
Reviewed-on: https://chromium-review.googlesource.com/202331
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Puthikorn Voravootivat <puthik@chromium.org>
Tested-by: Puthikorn Voravootivat <puthik@chromium.org>
diff --git a/client/bin/base_utils.py b/client/bin/base_utils.py
index 7dcb372..5147a97 100644
--- a/client/bin/base_utils.py
+++ b/client/bin/base_utils.py
@@ -674,6 +674,45 @@
     return disk_re.findall(df_output)
 
 
+def get_disk_size(disk_name):
+    """
+    Return size of disk in byte. Return 0 in Error Case
+
+    @param disk_name: disk name to find size
+    """
+    device = os.path.basename(disk_name)
+    for line in file('/proc/partitions'):
+        try:
+            major, minor, blocks, name = re.split(r' +', line.strip())
+        except ValueError:
+            continue
+        if name == device:
+            return 1024 * int(blocks)
+    return 0
+
+
+def get_disk_size_gb(disk_name):
+    """
+    Return size of disk in GB (10^9). Return 0 in Error Case
+
+    @param disk_name: disk name to find size
+    """
+    return int(get_disk_size(disk_name) / (10.0 ** 9) + 0.5)
+
+
+def get_disk_model(disk_name):
+    """
+    Return model name for internal storage device
+
+    @param disk_name: disk name to find model
+    """
+    cmd1 = 'udevadm info --query=property --name=%s' % disk_name
+    cmd2 = 'grep -E "ID_(NAME|MODEL)="'
+    cmd3 = 'cut -f 2 -d"="'
+    cmd = ' | '.join([cmd1, cmd2, cmd3])
+    return utils.system_output(cmd)
+
+
 def load_module(module_name):
     # Checks if a module has already been loaded
     if module_is_loaded(module_name):