RtlInitializeExceptionChain 有什么作用,如何减少它的执行开销?

2022-01-14 00:00:00 optimization com c++

我正在尝试在我的程序中找到瓶颈(目前处于唾手可得"阶段),并使用分析器得到如下结果:

I am trying to find bottlenecks in my program (currently in the "low-hanging fruit" stage), and using a profiler I get something like the following:

我在这里看到的是 RtlInitializeExceptionChain 占用了大部分时间,而我实际程序中的函数甚至没有进入这个顶级列表.我想知道是否有人知道 RtlInitializeExceptionChain 是做什么的,它是如何被调用的,以及我如何重新组织我的程序以减少调用它的次数?

The thing I see in this is that RtlInitializeExceptionChain takes up the far majority of the time, and functions from my actual program don't even make it onto this top list. I would like to know if anyone knows what RtlInitializeExceptionChain does, how it is called, and how I can reorganize my program to not call it so much?

关于我的项目的一些其他信息:它是一个使用 ATL 的 COM API,被分析的程序是一个使用这个 API 的测试"C++ 程序.

Some other information about my project: it is a COM API using ATL, and the program being profiled is a "testing" C++ program which consumes this API.

谢谢!

推荐答案

RtlInitializeExceptionChain 是运行时库中的一个内部函数,是内核模式驱动程序和操作系统本身使用的内核模式支持函数的集合.它是 C 运行时库的内核模式版本.

RtlInitializeExceptionChain is an internal function in the Run-Time Library, a collection of kernel-mode support functions used by kernel-mode drivers and the OS itself. It's kind of the kernel-mode version of the C run-time library.

如果您的应用程序是 32 位的,并且您在 64 位机器上对其进行分析,那么在 32 位机器上对其进行分析或构建 64 位版本可能会将 RtlInitializeExceptionChain 移出前 10 名,因为它是总是用于thunking.

If your application is 32-bit and you're profiling it on a 64-bit machine, profiling it on a 32-bit machine or building a 64-bit version will probably move RtlInitializeExceptionChain out of the top 10 list since it's always used in thunking.

否则,您几乎肯定无能为力.

Otherwise, there's almost certainly nothing you can do about it.

相关文章