Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/41393 )

Change subject: base: Clean up base/hostinfo
......................................................................

base: Clean up base/hostinfo

General fixes to the style of base/hostinfo.(cc|hh).

Remove unnecessary includes.

Remove signature of private functions from header.

Add documentation.

Remove unnecessary include in sim_events.cc.

Change-Id: I54e1f13231e512d26cf0127cc80256fb5e91bf91
Signed-off-by: Daniel R. Carvalho <oda...@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41393
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/base/hostinfo.cc
M src/base/hostinfo.hh
M src/sim/sim_events.cc
3 files changed, 15 insertions(+), 22 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc
index e835a10..577ab01 100644
--- a/src/base/hostinfo.cc
+++ b/src/base/hostinfo.cc
@@ -26,28 +26,20 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+#include "base/hostinfo.hh"
+
 #include <unistd.h>

 #ifdef __APPLE__
 #include <mach/mach_init.h>
 #include <mach/shared_region.h>
 #include <mach/task.h>
-
-#endif
-
-#include "base/hostinfo.hh"
-
-#include <cctype>
-#include <cerrno>
-#include <cmath>
+#else
 #include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <string>
+#endif

 #include "base/logging.hh"
 #include "base/str.hh"
-#include "base/types.hh"

 std::string
 __get_hostname()
@@ -65,10 +57,11 @@
     return hostname;
 }

+#ifndef __APPLE__
 uint64_t
 procInfo(const char *filename, const char *target)
 {
-    int  done = 0;
+    int done = 0;
     char line[80];
     char format[80];
     long usage;
@@ -82,7 +75,7 @@
                 sscanf(line, format, &usage);

                 fclose(fp);
-                return usage ;
+                return usage;
             }
         }
     }
@@ -92,6 +85,7 @@

     return 0;
 }
+#endif

 uint64_t
 memUsage()
diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh
index 5351cba..3efb6f4 100644
--- a/src/base/hostinfo.hh
+++ b/src/base/hostinfo.hh
@@ -29,20 +29,20 @@
 #ifndef __HOSTINFO_HH__
 #define __HOSTINFO_HH__

+#include <cstdint>
 #include <string>

-#include "base/types.hh"
-
-std::string __get_hostname();
-
+/**
+ * Get the host name for the current machine.
+ *
+ * @return The machine's host name.
+ */
 std::string &hostname();

-uint64_t procInfo(const char *filename, const char *target);
-
 /**
  * Determine the simulator process' total virtual memory usage.
  *
- * @return virtual memory usage in kilobytes
+ * @return Virtual memory usage in kilobytes
  */
 uint64_t memUsage();

diff --git a/src/sim/sim_events.cc b/src/sim/sim_events.cc
index af516d3..ba2cda2 100644
--- a/src/sim/sim_events.cc
+++ b/src/sim/sim_events.cc
@@ -45,7 +45,6 @@
 #include <string>

 #include "base/callback.hh"
-#include "base/hostinfo.hh"
 #include "sim/eventq.hh"
 #include "sim/sim_exit.hh"
 #include "sim/stats.hh"



1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41393
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I54e1f13231e512d26cf0127cc80256fb5e91bf91
Gerrit-Change-Number: 41393
Gerrit-PatchSet: 3
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to