2018-12-31 20:04:05 +01:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2018-12-31 20:04:05 +01:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/utils/port/config.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/Slice.h"
|
|
|
|
#include "td/utils/Status.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
struct Stat {
|
|
|
|
bool is_dir_;
|
|
|
|
bool is_reg_;
|
2023-01-04 14:39:33 +01:00
|
|
|
bool is_symbolic_link_;
|
2018-12-31 20:04:05 +01:00
|
|
|
int64 size_;
|
2020-01-02 23:01:39 +01:00
|
|
|
int64 real_size_;
|
2018-12-31 20:04:05 +01:00
|
|
|
uint64 atime_nsec_;
|
|
|
|
uint64 mtime_nsec_;
|
|
|
|
};
|
|
|
|
|
|
|
|
Result<Stat> stat(CSlice path) TD_WARN_UNUSED_RESULT;
|
|
|
|
|
2018-02-28 20:54:05 +01:00
|
|
|
struct CpuStat {
|
2020-06-14 03:01:02 +02:00
|
|
|
uint64 total_ticks_{0};
|
|
|
|
uint64 process_user_ticks_{0};
|
|
|
|
uint64 process_system_ticks_{0};
|
2018-02-28 20:54:05 +01:00
|
|
|
};
|
2020-06-14 01:49:10 +02:00
|
|
|
|
2018-02-28 20:54:05 +01:00
|
|
|
Result<CpuStat> cpu_stat() TD_WARN_UNUSED_RESULT;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
struct MemStat {
|
2018-02-11 14:05:51 +01:00
|
|
|
uint64 resident_size_ = 0;
|
|
|
|
uint64 resident_size_peak_ = 0;
|
|
|
|
uint64 virtual_size_ = 0;
|
|
|
|
uint64 virtual_size_peak_ = 0;
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Result<MemStat> mem_stat() TD_WARN_UNUSED_RESULT;
|
|
|
|
|
2020-06-14 01:31:57 +02:00
|
|
|
#if TD_PORT_POSIX
|
|
|
|
|
|
|
|
namespace detail {
|
|
|
|
Result<Stat> fstat(int native_fd);
|
|
|
|
} // namespace detail
|
|
|
|
|
|
|
|
Status update_atime(CSlice path) TD_WARN_UNUSED_RESULT;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
} // namespace td
|