MCPcopy Create free account
hub / github.com/apache/mesos / stat

Function stat

src/linux/cgroups.cpp:1744–1778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1742
1743
1744Try<hashmap<string, uint64_t>> stat(
1745 const string& hierarchy,
1746 const string& cgroup,
1747 const string& file)
1748{
1749 Try<string> contents = cgroups::read(hierarchy, cgroup, file);
1750
1751 if (contents.isError()) {
1752 return Error(contents.error());
1753 }
1754
1755 hashmap<string, uint64_t> result;
1756
1757 foreach (const string& line, strings::split(contents.get(), "\n")) {
1758 // Skip empty lines.
1759 if (strings::trim(line).empty()) {
1760 continue;
1761 }
1762
1763 string name;
1764 uint64_t value;
1765
1766 // Expected line format: "%s %llu".
1767 istringstream stream(line);
1768 stream >> name >> value;
1769
1770 if (stream.fail()) {
1771 return Error("Unexpected line format in " + file + ": " + line);
1772 }
1773
1774 result[name] = value;
1775 }
1776
1777 return result;
1778}
1779
1780
1781namespace internal {

Callers

nothing calls this directly

Calls 14

trimFunction · 0.85
ErrnoErrorClass · 0.85
StatsClass · 0.85
atMethod · 0.80
readFunction · 0.70
createFunction · 0.70
errorMethod · 0.65
ErrorFunction · 0.50
isErrorMethod · 0.45
emptyMethod · 0.45
failMethod · 0.45
isSomeMethod · 0.45

Tested by

no test coverage detected