[llvm-commits] [PATCH Proposal] Clean up Support/Process.h to modern llvm style.

Chandler Carruth chandlerc at google.com
Fri Aug 10 17:57:07 PDT 2012


Your subject line is a bit misleading, it's not yet in modern LLVM style...
;] Still, an improvement.

>From 049e77c972ab35097b81c78db478546c8e2bc928 Mon Sep 17 00:00:00 2001
From: Michael Spencer <bigcheesegs at gmail.com>
Date: Tue, 7 Aug 2012 12:50:19 -0700
Subject: [PATCH] [Support] Clean up the Process interface to modern llvm
 style.

---
 include/llvm/Support/Process.h |  110
++++++++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)

diff --git a/include/llvm/Support/Process.h b/include/llvm/Support/Process.h
index 088897c..c290d22 100644
--- a/include/llvm/Support/Process.h
+++ b/include/llvm/Support/Process.h
@@ -18,6 +18,116 @@

 namespace llvm {
 namespace sys {
+/// Get the virtual memory page size

Use \brief.

+///
+/// \returns The number of bytes in a virtual memory page.
+unsigned getPageSize();
+
+/// Get process memory usage.
+///
+/// This function will return the total amount of memory allocated by the
+/// process. This only counts the memory allocated via the malloc, calloc
and
+/// realloc functions and includes any "free" holes in the allocated space.
+size_t getMallocUsage();
+
+/// This function will set \p user_time to the amount of CPU time spent in
user
+/// (non-kernel) mode and \p sys_time to the amount of CPU time spent in
system
+/// (kernel) mode.  If the operating system does not support collection of
these
+/// metrics, a zero TimeValue will be for both values.
+void getTimeUsage(
+  TimeValue &Elapsed,
+    ///< Returns the TimeValue::now() giving current time

Please no, this makes the actual signatures nearly impossible to read.

Use the much more widespread '\param' tag in the body of the doxygen
comment above.

+  TimeValue &UserTime,
+    ///< Returns the current amount of user time for the process
+  TimeValue &SysTime
+    ///< Returns the current amount of system time for the process
+  );

And never put this on the next line. It makes it far too easy to omit or
add extraneous ','s after parameters.

Also, by splitting every bit of this declaration across so many lines you
make the diagnostic quality worse because we can't snippet anything
effectively.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120810/b262fc5c/attachment.html>


More information about the llvm-commits mailing list