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

Side by Side Diff: base/process/process_metrics_posix.cc

Issue 786123002: Update from https://crrev.com/307330 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « base/process/launch_win.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process/process_metrics.h" 5 #include "base/process/process_metrics.h"
6 6
7 #include <sys/resource.h> 7 #include <sys/resource.h>
8 #include <sys/time.h> 8 #include <sys/time.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 11
12 namespace base { 12 namespace base {
13 13
14 int64 TimeValToMicroseconds(const struct timeval& tv) { 14 int64 TimeValToMicroseconds(const struct timeval& tv) {
15 static const int kMicrosecondsPerSecond = 1000000;
16 int64 ret = tv.tv_sec; // Avoid (int * int) integer overflow. 15 int64 ret = tv.tv_sec; // Avoid (int * int) integer overflow.
17 ret *= kMicrosecondsPerSecond; 16 ret *= Time::kMicrosecondsPerSecond;
18 ret += tv.tv_usec; 17 ret += tv.tv_usec;
19 return ret; 18 return ret;
20 } 19 }
21 20
22 ProcessMetrics::~ProcessMetrics() { } 21 ProcessMetrics::~ProcessMetrics() { }
23 22
24 #if defined(OS_LINUX) 23 #if defined(OS_LINUX)
25 static const rlim_t kSystemDefaultMaxFds = 8192; 24 static const rlim_t kSystemDefaultMaxFds = 8192;
26 #elif defined(OS_MACOSX) 25 #elif defined(OS_MACOSX)
27 static const rlim_t kSystemDefaultMaxFds = 256; 26 static const rlim_t kSystemDefaultMaxFds = 256;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 limits.rlim_cur = new_limit; 62 limits.rlim_cur = new_limit;
64 if (setrlimit(RLIMIT_NOFILE, &limits) != 0) { 63 if (setrlimit(RLIMIT_NOFILE, &limits) != 0) {
65 PLOG(INFO) << "Failed to set file descriptor limit"; 64 PLOG(INFO) << "Failed to set file descriptor limit";
66 } 65 }
67 } else { 66 } else {
68 PLOG(INFO) << "Failed to get file descriptor limit"; 67 PLOG(INFO) << "Failed to get file descriptor limit";
69 } 68 }
70 } 69 }
71 70
72 } // namespace base 71 } // namespace base
OLDNEW
« no previous file with comments | « base/process/launch_win.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698