| 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 | { |
nothing calls this directly
no test coverage detected