MCPcopy Create free account
hub / github.com/catboost/catboost / THostEntropy

Method THostEntropy

util/random/entropy.cpp:40–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39 struct THostEntropy: public TBuffer {
40 inline THostEntropy() {
41 {
42 TBufferOutput buf(*this);
43 TZLibCompress out(&buf);
44
45 Save(&out, GetPID());
46 Save(&out, GetCycleCount());
47 Save(&out, MicroSeconds());
48 Save(&out, TThread::CurrentThreadId());
49 Save(&out, NSystemInfo::CachedNumberOfCpus());
50 Save(&out, NSystemInfo::TotalMemorySize());
51 Save(&out, HostName());
52
53 try {
54 Save(&out, GetExecPath());
55 } catch (...) {
56 // workaround - sometimes fails on FreeBSD
57 }
58
59 Save(&out, (size_t)Data());
60 Save(&out, (size_t)&buf);
61
62 {
63 double la[3];
64
65 NSystemInfo::LoadAverage(la, Y_ARRAY_SIZE(la));
66
67 out.Write(la, sizeof(la));
68 }
69
70 {
71 auto mi = NMemInfo::GetMemInfo();
72
73 out.Write(&mi, sizeof(mi));
74 }
75
76 {
77 auto ru = TRusage::Get();
78
79 out.Write(&ru, sizeof(ru));
80 }
81
82 {
83 ui32 store[12];
84
85 out << TStringBuf(CpuBrand(store));
86 }
87
88 try {
89 out << NFs::CurrentWorkingDirectory();
90 } catch (const TSystemError& e) {
91 // the current working directory has been unliked or unavailable for similar reasons
92 }
93
94 out.Finish();
95 }
96
97 {

Callers

nothing calls this directly

Calls 13

GetPIDFunction · 0.85
GetCycleCountFunction · 0.85
MicroSecondsFunction · 0.85
GetMemInfoFunction · 0.85
CpuBrandFunction · 0.85
PermuteFunction · 0.70
SaveFunction · 0.50
DataClass · 0.50
GetFunction · 0.50
SizeFunction · 0.50
CityHash64Function · 0.50
WriteMethod · 0.45

Tested by

no test coverage detected