g++以静态成员为键的 gprof 全局构造函数

发布于 2024-12-26 22:17:42 字数 370 浏览 4 评论 0原文

我正在 Linux 上分析使用 g++ 编译的 C++ 应用程序。

在 gprof 输出中,我得到了一些重要的使用统计信息:

global constructors keyed to _ZN4CGps14ms_OutputNamesE

其中 _ZN4CGps14ms_OutputNamesE 是我的类之一的静态成员的损坏名称。它是一个 std::strings 数组:

static std::string ms_OutputNames[MAXOUTPUTS];

我有点惊讶的是,它没有在应用程序开始时被构造一次。是否正在进行某种保护变量或首次使用检查?我将如何优化这个?

I'm profiling a c++ app on linux compiled with g++.

In the gprof output I'm getting some nontrivial usage statistics for:

global constructors keyed to _ZN4CGps14ms_OutputNamesE

Where _ZN4CGps14ms_OutputNamesE is the mangled name of a static member of one of my classes. It's an array of std::strings:

static std::string ms_OutputNames[MAXOUTPUTS];

I'm a bit surprised that this isn't being constructed once at the beginning of the app. Is there some sort of guard variable or first usage check going on? How would I go about optimising this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文