diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-23 03:56:09 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-23 03:56:09 +0000 |
commit | 4f62caf05bdf3e8c1b847defd1c396693e67b253 (patch) | |
tree | 35896009d9d23b7d517d4b9da9aac323f3140540 | |
parent | 996e0878845c1aee847e5dac5b47831d5527955e (diff) | |
download | chromium_src-4f62caf05bdf3e8c1b847defd1c396693e67b253.zip chromium_src-4f62caf05bdf3e8c1b847defd1c396693e67b253.tar.gz chromium_src-4f62caf05bdf3e8c1b847defd1c396693e67b253.tar.bz2 |
ChromiumOS: read /proc/uptime without using system().
BUG=32938
TEST=ChromiumOS valgrind becomes happier.
Review URL: http://codereview.chromium.org/553062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36946 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/browser_notification_observers.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/browser_notification_observers.cc b/chrome/browser/chromeos/browser_notification_observers.cc index e47c452..c576ea4 100644 --- a/chrome/browser/chromeos/browser_notification_observers.cc +++ b/chrome/browser/chromeos/browser_notification_observers.cc @@ -4,6 +4,9 @@ #include "chrome/browser/chromeos/browser_notification_observers.h" +#include <string> + +#include "base/file_util.h" #include "chrome/browser/chrome_thread.h" #include "chrome/common/notification_service.h" @@ -11,7 +14,12 @@ namespace { // Static function that records uptime in /proc/uptime to tmp for metrics use. void RecordUptime() { - system("cat /proc/uptime > /tmp/uptime-chrome-first-render &"); + std::string uptime; + const FilePath proc_uptime = FilePath("/proc/uptime"); + const FilePath uptime_output = FilePath("/tmp/uptime-chrome-first-render"); + + if (file_util::ReadFileToString(proc_uptime, &uptime)) + file_util::WriteFile(uptime_output, uptime.data(), uptime.size()); } } // namespace |