Fix all our unused parameter warnings so we let GCC report them.

There were a couple of genuine bugs here (fixed), plus there's a missing
feature in trace.cc that I've just added a TODO for.

Also note that I haven't touched the compilers; this warning is still
explicitly disabled for that code. I'll do that when there's less going
on in those directories.

Change-Id: Ic3570bf82411a07c7530bfaf1995ac995b9fc00f
diff --git a/src/thread.cc b/src/thread.cc
index 58ef1fe..d9de1cb 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -436,31 +436,6 @@
   }
 }
 
-std::string GetSchedulerGroup(pid_t tid) {
-  // /proc/<pid>/group looks like this:
-  // 2:devices:/
-  // 1:cpuacct,cpu:/
-  // We want the third field from the line whose second field contains the "cpu" token.
-  std::string cgroup_file;
-  if (!ReadFileToString("/proc/self/cgroup", &cgroup_file)) {
-    return "";
-  }
-  std::vector<std::string> cgroup_lines;
-  Split(cgroup_file, '\n', cgroup_lines);
-  for (size_t i = 0; i < cgroup_lines.size(); ++i) {
-    std::vector<std::string> cgroup_fields;
-    Split(cgroup_lines[i], ':', cgroup_fields);
-    std::vector<std::string> cgroups;
-    Split(cgroup_fields[1], ',', cgroups);
-    for (size_t i = 0; i < cgroups.size(); ++i) {
-      if (cgroups[i] == "cpu") {
-        return cgroup_fields[2].substr(1); // Skip the leading slash.
-      }
-    }
-  }
-  return "";
-}
-
 String* Thread::GetThreadName() const {
   return (peer_ != NULL) ? reinterpret_cast<String*>(gThread_name->GetObject(peer_)) : NULL;
 }
@@ -491,9 +466,9 @@
   sched_param sp;
   CHECK_PTHREAD_CALL(pthread_getschedparam, (pthread_self(), &policy, &sp), __FUNCTION__);
 
-  std::string scheduler_group(GetSchedulerGroup(GetTid()));
-  if (scheduler_group.empty()) {
-    scheduler_group = "default";
+  std::string scheduler_group_name(GetSchedulerGroupName(GetTid()));
+  if (scheduler_group_name.empty()) {
+    scheduler_group_name = "default";
   }
 
   os << '"' << *name_ << '"';
@@ -512,7 +487,7 @@
   os << "  | sysTid=" << GetTid()
      << " nice=" << getpriority(PRIO_PROCESS, GetTid())
      << " sched=" << policy << "/" << sp.sched_priority
-     << " cgrp=" << scheduler_group
+     << " cgrp=" << scheduler_group_name
      << " handle=" << pthread_self() << "\n";
 
   // Grab the scheduler stats for this thread.
@@ -1068,7 +1043,7 @@
  public:
   CountStackDepthVisitor() : depth_(0), skip_depth_(0), skipping_(true) {}
 
-  bool VisitFrame(const Frame& frame, uintptr_t pc) {
+  bool VisitFrame(const Frame& frame, uintptr_t /*pc*/) {
     // We want to skip frames up to and including the exception's constructor.
     // Note we also skip the frame if it doesn't have a method (namely the callee
     // save frame)