Add current chrome version to generated AFDO perf data

Add the chrome version of the name of the generated AFDO perf.data
file. Had to add necessary support in cros_host class and in the
process commonized some code with site_sysinfo.py

BUG=None
TEST=Tested through test_that.

Change-Id: I4d6537c78f21febadc566b7ea8b3238dc809e135
Reviewed-on: https://chromium-review.googlesource.com/183132
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Luis Lozano <llozano@chromium.org>
Tested-by: Luis Lozano <llozano@chromium.org>
diff --git a/client/common_lib/site_utils.py b/client/common_lib/site_utils.py
index f5c9069..69f769c 100644
--- a/client/common_lib/site_utils.py
+++ b/client/common_lib/site_utils.py
@@ -253,3 +253,22 @@
         raise
     finally:
         socket.setdefaulttimeout(old_timeout)
+
+
+def parse_chrome_version(version_string):
+    """
+    Parse a chrome version string and return version and milestone.
+
+    Given a chrome version of the form "W.X.Y.Z", return "W.X.Y.Z" as
+    the version and "W" as the milestone.
+
+    @param version_string: Chrome version string.
+    @return: a tuple (chrome_version, milestone). If the incoming version
+             string is not of the form "W.X.Y.Z", chrome_version will
+             be set to the incoming "version_string" argument and the
+             milestone will be set to the empty string.
+    """
+    match = re.search('(\d+)\.\d+\.\d+\.\d+', version_string)
+    ver = match.group(0) if match else version_string
+    milestone = match.group(1) if match else ''
+    return ver, milestone