在c++代码中使用嵌入式汇编语言进行错误分析
Error profiling with embedded assembly language in C++ code
我找到了这篇关于std::vector::push_back
效率的文章,相关代码可以在这里找到。我自己尝试了一下,我得到了一个illegal instruction (core dumped)
, gdb指示错误发生在第37行。
我使用gcc 4.7.2进行编译,在计算机上使用:
$ sudo dmidecode -t processor
# dmidecode 2.11
SMBIOS 2.5 present.
Handle 0x0400, DMI type 4, 40 bytes
Processor Information
Socket Designation: CPU
Type: Central Processor
Family: Core 2 Duo
Manufacturer: Intel
ID: 7A 06 01 00 FF FB EB BF
Signature: Type 0, Family 6, Model 23, Stepping 10
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (FXSAVE and FXSTOR instructions supported)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Multi-threading)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Not Specified
Voltage: 1.2 V
External Clock: 1333 MHz
Max Speed: 5200 MHz
Current Speed: 3000 MHz
Status: Populated, Enabled
Upgrade: Socket LGA775
L1 Cache Handle: 0x0700
L2 Cache Handle: 0x0701
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 2
Core Enabled: 2
Thread Count: 2
Characteristics:
64-bit capable
这里有什么问题?我怎样才能使这个代码工作?我也尝试了icpc 13.1.0,但这也失败了。
编辑:我使用Ubuntu 12.10 64位。
您的CPU不支持RDTSCP
指令。这是一条酷睿i7指令,而你的处理器是较早一代的(Merom-L)。
您应该能够使用RDTSC
代替。例如,参见"rdtscp, rdtsc: memory和cpuid/rdtsc之间的差异?"
相关文章:
- 警告处理为错误这里有什么问题
- (C++)分析树以计算返回错误值的简单算术表达式
- 如何解决C++中声纳库贝静态代码分析错误"Explicitly define the missing copy constructor, move constructor .."
- 模板实例化分析错误
- 线性全余生成器的分析是错误的吗?
- 声纳库贝分析在 Eclipse 中失败,由于找不到异常语言"cpp"在本地分析中抛出错误
- VS2010代码分析奇怪的数组限制错误
- 使用分析工具的函数调用图选项时出现日食 CDT 错误
- GLSL 语法错误:"in"分析错误
- 使用Visual Studio 2012代码分析时出现错误C2248
- C++:错误:摘要字符串分析错误
- 如何使用模板化库控制静态分析编译器错误消息
- 是否有任何c++静态分析工具来检测向量的潜在错误
- 奇怪的分割错误和valgrind分析
- 参数分析错误
- 使用cmake和Qt4进行制作时出现RCC分析错误
- 为什么Xcode 4.3静态分析报告此代码的逻辑错误
- 在c++代码中使用嵌入式汇编语言进行错误分析
- Visual Studio 2015:C++代码分析错误 C1253,无法加载模型文件"res://mspft140.dll/300"
- BFD:矮人错误:在使用GNU 4.7.2使用HPCToolKit分析openmp程序时