簡體   English   中英

使用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指令。 這是Core i7指令,您的處理器是更早的一代( Merom-L )。

您應該可以改用RDTSC 例如,請參見rdtscp,rdtsc:內存和cpuid / rdtsc之間的區別?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM