当我想在 WSL 下运行 perf 时,我遇到了以下问题:
警告:找不到内核 4.4.0-18362 的性能
您可能需要为此特定内核安装以下软件包:
linux-tools-4.4.0-18362-Microsoft
linux-cloud-tools-4.4.0-18362-Microsoft
您可能还需要安装以下软件包之一以保持最新状态:
linux-tools-微软
linux-cloud-tools-微软
但我找不到名为linux-tools-4.4.0-18362-Microsoftor 的包linux-cloud-tools-4.4.0-18362-Microsoft。我猜包名是自动生成的。
我还尝试在 docker 容器中使用 perf。但是,docker 容器使用与主机相同的内核。
有没有什么方法可以在 WSL 下运行 perf?
我听说在 WSL2 中可以使用 perf。但是在我升级到 WSL2 后,它显示了类似的错误消息:
警告:找不到内核 4.19.84-microsoft 的性能
您可能需要为此特定内核安装以下软件包:
Run Code Online (Sandbox Code Playgroud)linux-tools-4.19.84-microsoft-standard linux-cloud-tools-4.19.84-microsoft-standard您可能还需要安装以下软件包之一以保持最新状态:
Run Code Online (Sandbox Code Playgroud)linux-tools-standard linux-cloud-tools-standard
Expected<T>在llvm / Support / Error.h中实现。这是一个标记的并集,包含a T或a Error。
Expected<T>是类型为的模板类T:
template <class T> class LLVM_NODISCARD Expected
Run Code Online (Sandbox Code Playgroud)
但是,这两个构造函数确实使我感到困惑:
/// Move construct an Expected<T> value from an Expected<OtherT>, where OtherT
/// must be convertible to T.
template <class OtherT>
Expected(Expected<OtherT> &&Other,
typename std::enable_if<std::is_convertible<OtherT, T>::value>::type
* = nullptr) {
moveConstruct(std::move(Other));
}
/// Move construct an Expected<T> value from an Expected<OtherT>, where OtherT
/// isn't convertible to T.
template <class OtherT>
explicit Expected(
Expected<OtherT> &&Other,
typename std::enable_if<!std::is_convertible<OtherT, T>::value>::type * = …Run Code Online (Sandbox Code Playgroud)