mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-13 01:36:10 +00:00
* 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>
43 lines
710 B
C++
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_
|