Files
mscclpp/include/mscclpp/utils.hpp
Saeed Maleki 8d1b984bed Change device handle interfaces & others (#142)
* Changed device handle interfaces
* Changed proxy service interfaces
* Move device code into separate files
* Fixed FIFO polling issues
* Add configuration arguments in several interface functions

---------

Co-authored-by: Changho Hwang <changhohwang@microsoft.com>
Co-authored-by: Binyang Li <binyli@microsoft.com>
Co-authored-by: root <root@a100-saemal0.qxveptpukjsuthqvv514inp03c.gx.internal.cloudapp.net>
2023-08-16 20:00:56 +08:00

43 lines
710 B
C++

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#ifndef MSCCLPP_UTILS_HPP_
#define MSCCLPP_UTILS_HPP_
#include <chrono>
#include <string>
namespace mscclpp {
struct Timer {
std::chrono::steady_clock::time_point start_;
int timeout_;
Timer(int timeout = -1);
~Timer();
/// Returns the elapsed time in milliseconds.
int64_t elapsed() const;
void set(int timeout);
void reset();
void print(const std::string& name);
};
struct ScopedTimer : public Timer {
const std::string name_;
ScopedTimer(const std::string& name);
~ScopedTimer();
};
std::string getHostName(int maxlen, const char delim);
} // namespace mscclpp
#endif // MSCCLPP_UTILS_HPP_