|
CCTLib
Calling-context and data-object attribution library for Intel Pin
|
#include <stdio.h>#include <stdlib.h>#include <stdint.h>#include <iostream>#include <unistd.h>#include <assert.h>#include <string.h>#include <sys/mman.h>#include <sstream>#include <functional>#include <unordered_set>#include <vector>#include <unordered_map>#include <algorithm>#include "pin.H"#include "cctlib.H"
Include dependency graph for footprint_client.cpp:Go to the source code of this file.
Classes | |
| struct | RawMetric_t |
| struct | AnalyzedMetric_t |
| struct | UnrolledLoop< start, end, incr > |
| struct | UnrolledLoop< end, end, incr > |
| struct | UnrolledConjunction< start, end, incr > |
| struct | UnrolledConjunction< end, end, incr > |
| struct | MemAnalysis< AccessLen > |
Functions | |
| static INT32 | Usage () |
| static void | ClientInit (int argc, char *argv[]) |
| static uint8_t * | GetOrCreateShadowBaseAddress (uint64_t address) |
| static bool | CheckDependence (uint64_t curAddr, uint64_t prevAddr) |
| static RawMetric_t * | UpdateFootPrint (uint64_t address, THREADID threadId, uint16_t accessLen) |
| static bool | IsFwdDependence (ADDRINT prevIp, ADDRINT curIp) |
| static VOID | RecordOneByteMemWrite (void *addr, ADDRINT insPtr) |
| static VOID | RecordOneByteMemRead (void *addr, ADDRINT insPtr, RawMetric_t *metric) |
| static VOID | RecordLargeMemRead (void *addr, UINT32 accessLen, uint32_t opaqueHandle, ADDRINT insPtr, THREADID threadId) |
| static VOID | RecordLargeMemWrite (void *addr, UINT32 accessLen, uint32_t opaqueHandle, ADDRINT insPtr, THREADID threadId) |
| static VOID | InstrumentInsCallback (INS ins, VOID *v, const uint32_t opaqueHandle) |
| static void | DecodingFootPrint (const THREADID threadid, ContextHandle_t myHandle, ContextHandle_t parentHandle, void **myMetric, void **parentMetric) |
| static void | MergeFootPrint (const THREADID threadid, ContextHandle_t myHandle, ContextHandle_t parentHandle, void **myMetric, void **parentMetric) |
| static bool | FootPrintCompare (const struct AnalyzedMetric_t &first, const struct AnalyzedMetric_t &second) |
| static void | PrintTopFootPrintPath (THREADID threadid) |
| static VOID | ThreadFiniFunc (THREADID threadid, const CONTEXT *ctxt, INT32 code, VOID *v) |
| static VOID | FiniFunc (INT32 code, VOID *v) |
| int | main (int argc, char *argv[]) |
Variables | |
| static std::unordered_map< uint32_t, struct RawMetric_t > * | hmap_vector |
| static FILE * | gTraceFile |
| static uint8_t ** | gL1PageTable [LEVEL_1_PAGE_TABLE_SIZE] |
| static const uint64_t | READ_ACCESS_STATES [] = { 0, ONE_BYTE_READ_ACTION, TWO_BYTE_READ_ACTION, 0, FOUR_BYTE_READ_ACTION, 0, 0, 0, EIGHT_BYTE_READ_ACTION} |
| static const uint64_t | WRITE_ACCESS_STATES [] = { 0, ONE_BYTE_WRITE_ACTION, TWO_BYTE_WRITE_ACTION, 0, FOUR_BYTE_WRITE_ACTION, 0, 0, 0, EIGHT_BYTE_WRITE_ACTION} |
| static const uint8_t | OVERFLOW_CHECK [] = { 0, 0, 0, 1, 2, 3, 4, 5, 6} |
| #define DECODE_ACCESS_LEN | ( | addrAndLen | ) | ((addrAndLen) >> 48) |
Definition at line 70 of file footprint_client.cpp.
| #define DECODE_ADDRESS | ( | addrAndLen | ) | ((addrAndLen) & ((1L << 48) - 1)) |
Definition at line 69 of file footprint_client.cpp.
| #define EIGHT_BYTE_READ_ACTION (0) |
Definition at line 56 of file footprint_client.cpp.
| #define EIGHT_BYTE_WRITE_ACTION (0xffffffffffffffff) |
Definition at line 61 of file footprint_client.cpp.
| #define ENCODE_ADDRESS_AND_ACCESS_LEN | ( | addr, | |
| len | |||
| ) | ((addr) | (((uint64_t)(len)) << 48)) |
Definition at line 68 of file footprint_client.cpp.
| #define FOUR_BYTE_READ_ACTION (0) |
Definition at line 55 of file footprint_client.cpp.
| #define FOUR_BYTE_WRITE_ACTION (0xffffffff) |
Definition at line 60 of file footprint_client.cpp.
| #define HANDLE_CASE | ( | NUM | ) |
Definition at line 324 of file footprint_client.cpp.
| #define LEVEL_1_PAGE_TABLE_BITS (20) |
Definition at line 37 of file footprint_client.cpp.
| #define LEVEL_1_PAGE_TABLE_ENTRIES (1 << LEVEL_1_PAGE_TABLE_BITS) |
Definition at line 38 of file footprint_client.cpp.
| #define LEVEL_1_PAGE_TABLE_SIZE (LEVEL_1_PAGE_TABLE_ENTRIES * PTR_SIZE) |
Definition at line 39 of file footprint_client.cpp.
| #define LEVEL_1_PAGE_TABLE_SLOT | ( | addr | ) | (((addr) >> (LEVEL_2_PAGE_TABLE_BITS + PAGE_OFFSET_BITS)) & 0xfffff) |
Definition at line 45 of file footprint_client.cpp.
| #define LEVEL_2_PAGE_TABLE_BITS (12) |
Definition at line 41 of file footprint_client.cpp.
| #define LEVEL_2_PAGE_TABLE_ENTRIES (1 << LEVEL_2_PAGE_TABLE_BITS) |
Definition at line 42 of file footprint_client.cpp.
| #define LEVEL_2_PAGE_TABLE_SIZE (LEVEL_2_PAGE_TABLE_ENTRIES * PTR_SIZE) |
Definition at line 43 of file footprint_client.cpp.
| #define LEVEL_2_PAGE_TABLE_SLOT | ( | addr | ) | (((addr) >> (PAGE_OFFSET_BITS)) & 0xFFF) |
Definition at line 46 of file footprint_client.cpp.
| #define MAX_FOOTPRINT_CONTEXTS_TO_LOG (1000) |
Definition at line 65 of file footprint_client.cpp.
| #define ONE_BYTE_READ_ACTION (0) |
Definition at line 53 of file footprint_client.cpp.
| #define ONE_BYTE_WRITE_ACTION (0xff) |
Definition at line 58 of file footprint_client.cpp.
| #define PAGE_OFFSET | ( | addr | ) | (addr & 0xFFFF) |
Definition at line 29 of file footprint_client.cpp.
| #define PAGE_OFFSET_BITS (16LL) |
Definition at line 28 of file footprint_client.cpp.
| #define PAGE_OFFSET_MASK (0xFFFF) |
Definition at line 30 of file footprint_client.cpp.
| #define PAGE_SIZE (1 << PAGE_OFFSET_BITS) |
Definition at line 33 of file footprint_client.cpp.
| #define PTR_SIZE (sizeof(void*)) |
Definition at line 36 of file footprint_client.cpp.
| #define READ_ACTION (0) |
Definition at line 50 of file footprint_client.cpp.
| #define THREAD_MAX (1024) |
Definition at line 66 of file footprint_client.cpp.
| #define TWO_BYTE_READ_ACTION (0) |
Definition at line 54 of file footprint_client.cpp.
| #define TWO_BYTE_WRITE_ACTION (0xffff) |
Definition at line 59 of file footprint_client.cpp.
| #define WRITE_ACTION (0xff) |
Definition at line 51 of file footprint_client.cpp.
|
inlinestatic |
Definition at line 171 of file footprint_client.cpp.
|
static |
Definition at line 131 of file footprint_client.cpp.
References gTraceFile, hmap_vector, MAX_FILE_PATH, and THREAD_MAX.
Referenced by main().
|
static |
Definition at line 369 of file footprint_client.cpp.
References RawMetric_t::addressSet, RawMetric_t::addressSetDecoded, DECODE_ACCESS_LEN, and DECODE_ADDRESS.
Referenced by ThreadFiniFunc().
|
static |
Definition at line 452 of file footprint_client.cpp.
Referenced by main().
|
inlinestatic |
Definition at line 406 of file footprint_client.cpp.
References AnalyzedMetric_t::footprint.
Referenced by PrintTopFootPrintPath().
|
static |
Definition at line 159 of file footprint_client.cpp.
References address, gL1PageTable, LEVEL_1_PAGE_TABLE_SLOT, LEVEL_2_PAGE_TABLE_SIZE, LEVEL_2_PAGE_TABLE_SLOT, and PAGE_SIZE.
Referenced by MemAnalysis< AccessLen >::RecordNByteMemRead(), MemAnalysis< AccessLen >::RecordNByteMemWrite(), RecordOneByteMemRead(), and RecordOneByteMemWrite().
|
static |
Definition at line 334 of file footprint_client.cpp.
References HANDLE_CASE, RecordLargeMemRead(), and RecordLargeMemWrite().
Referenced by main().
|
inlinestatic |
Definition at line 236 of file footprint_client.cpp.
Referenced by MemAnalysis< AccessLen >::RecordNByteMemRead(), and RecordOneByteMemRead().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 457 of file footprint_client.cpp.
References ClientInit(), FiniFunc(), gTraceFile, InstrumentInsCallback(), INTERESTING_INS_MEMORY_ACCESS, PinCCTLib::PinCCTLibInit(), ThreadFiniFunc(), and Usage().
|
static |
Definition at line 385 of file footprint_client.cpp.
References RawMetric_t::accessNum, RawMetric_t::addressSetDecoded, RawMetric_t::backwardsDependence, RawMetric_t::forwardDependence, and hmap_vector.
Referenced by ThreadFiniFunc().
|
static |
Definition at line 410 of file footprint_client.cpp.
References AnalyzedMetric_t::accessNum, AnalyzedMetric_t::backwardsDependence, AnalyzedMetric_t::footprint, FootPrintCompare(), AnalyzedMetric_t::forwardDependence, gTraceFile, AnalyzedMetric_t::handle, hmap_vector, MAX_FOOTPRINT_CONTEXTS_TO_LOG, and PinCCTLib::PrintFullCallingContext().
Referenced by ThreadFiniFunc().
|
inlinestatic |
Definition at line 310 of file footprint_client.cpp.
References PinCCTLib::metric, RecordOneByteMemRead(), and UpdateFootPrint().
Referenced by InstrumentInsCallback().
|
inlinestatic |
Definition at line 317 of file footprint_client.cpp.
References RecordOneByteMemWrite(), and UpdateFootPrint().
Referenced by InstrumentInsCallback().
|
inlinestatic |
Definition at line 248 of file footprint_client.cpp.
References GetOrCreateShadowBaseAddress(), IsFwdDependence(), PinCCTLib::metric, PAGE_OFFSET, and PinCCTLib::status.
Referenced by RecordLargeMemRead(), and MemAnalysis< AccessLen >::RecordNByteMemRead().
|
inlinestatic |
Definition at line 241 of file footprint_client.cpp.
References GetOrCreateShadowBaseAddress(), PAGE_OFFSET, and PinCCTLib::status.
Referenced by RecordLargeMemWrite(), and MemAnalysis< AccessLen >::RecordNByteMemWrite().
|
static |
Definition at line 440 of file footprint_client.cpp.
References DecodingFootPrint(), MergeFootPrint(), and PrintTopFootPrintPath().
Referenced by main().
|
inlinestatic |
Definition at line 214 of file footprint_client.cpp.
References address, ENCODE_ADDRESS_AND_ACCESS_LEN, PinCCTLib::GetContextHandle(), hmap_vector, and PinCCTLib::metric.
Referenced by RecordLargeMemRead(), RecordLargeMemWrite(), MemAnalysis< AccessLen >::RecordNByteMemRead(), and MemAnalysis< AccessLen >::RecordNByteMemWrite().
|
static |
Definition at line 121 of file footprint_client.cpp.
Referenced by main().
|
static |
Definition at line 128 of file footprint_client.cpp.
Referenced by GetOrCreateShadowBaseAddress().
|
static |
Definition at line 127 of file footprint_client.cpp.
Referenced by ClientInit(), main(), and PrintTopFootPrintPath().
|
static |
Definition at line 89 of file footprint_client.cpp.
Referenced by ClientInit(), MergeFootPrint(), PrintTopFootPrintPath(), and UpdateFootPrint().
|
static |
Definition at line 234 of file footprint_client.cpp.
|
static |
Definition at line 232 of file footprint_client.cpp.
|
static |
Definition at line 233 of file footprint_client.cpp.