|
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 <sys/time.h>#include <sstream>#include "pin.H"#include "cctlib.H"#include <unordered_set>#include <vector>#include <unordered_map>#include <algorithm>
Include dependency graph for footprint_client2.cpp:Go to the source code of this file.
Classes | |
| struct | node_metric_t |
| struct | sort_format_t |
Macros | |
| #define | PAGE_OFFSET_BITS (16LL) |
| #define | PAGE_OFFSET(addr) (addr & 0xFFFF) |
| #define | PAGE_OFFSET_MASK (0xFFFF) |
| #define | PAGE_SIZE (1 << PAGE_OFFSET_BITS) |
| #define | PTR_SIZE (sizeof(void*)) |
| #define | LEVEL_1_PAGE_TABLE_BITS (20) |
| #define | LEVEL_1_PAGE_TABLE_ENTRIES (1 << LEVEL_1_PAGE_TABLE_BITS) |
| #define | LEVEL_1_PAGE_TABLE_SIZE (LEVEL_1_PAGE_TABLE_ENTRIES * PTR_SIZE) |
| #define | LEVEL_2_PAGE_TABLE_BITS (12) |
| #define | LEVEL_2_PAGE_TABLE_ENTRIES (1 << LEVEL_2_PAGE_TABLE_BITS) |
| #define | LEVEL_2_PAGE_TABLE_SIZE (LEVEL_2_PAGE_TABLE_ENTRIES * PTR_SIZE) |
| #define | LEVEL_1_PAGE_TABLE_SLOT(addr) (((addr) >> (LEVEL_2_PAGE_TABLE_BITS + PAGE_OFFSET_BITS)) & 0xfffff) |
| #define | LEVEL_2_PAGE_TABLE_SLOT(addr) (((addr) >> (PAGE_OFFSET_BITS)) & 0xFFF) |
| #define | MAX_FOOTPRINT_CONTEXTS_TO_LOG (1000) |
| #define | THREAD_MAX (1024) |
Functions | |
| static INT32 | Usage () |
| void | ClientInit (int argc, char *argv[]) |
| uint8_t * | GetOrCreateShadowBaseAddress (uint64_t address) |
| bool | CheckDependence (uint64_t curAddr, uint64_t prevAddr) |
| VOID | MemFunc (THREADID id, void *addr, bool rwFlag, UINT32 refSize) |
| VOID | InstrumentInsCallback (INS ins, VOID *v, const uint32_t slot) |
| void | DecodingFootPrint (const THREADID threadid, ContextHandle_t myHandle, ContextHandle_t parentHandle, void **myMetric, void **parentMetric) |
| void | MergeFootPrint (const THREADID threadid, ContextHandle_t myHandle, ContextHandle_t parentHandle, void **myMetric, void **parentMetric) |
| bool | FootPrintCompare (const struct sort_format_t &first, const struct sort_format_t &second) |
| void | PrintTopFootPrintPath (THREADID threadid) |
| VOID | ThreadFiniFunc (THREADID threadid, const CONTEXT *ctxt, INT32 code, VOID *v) |
| VOID | FiniFunc (INT32 code, VOID *v) |
| int | main (int argc, char *argv[]) |
Variables | |
| uint8_t ** | gL1PageTable [LEVEL_1_PAGE_TABLE_SIZE] |
| unordered_map< uint32_t, struct node_metric_t > | hmap_vector [THREAD_MAX] |
| FILE * | gTraceFile |
| struct timeval | tv1 |
| __thread struct timeval | tv2 |
| __thread struct timeval | tv3 |
| #define LEVEL_1_PAGE_TABLE_BITS (20) |
Definition at line 38 of file footprint_client2.cpp.
| #define LEVEL_1_PAGE_TABLE_ENTRIES (1 << LEVEL_1_PAGE_TABLE_BITS) |
Definition at line 39 of file footprint_client2.cpp.
| #define LEVEL_1_PAGE_TABLE_SIZE (LEVEL_1_PAGE_TABLE_ENTRIES * PTR_SIZE) |
Definition at line 40 of file footprint_client2.cpp.
| #define LEVEL_1_PAGE_TABLE_SLOT | ( | addr | ) | (((addr) >> (LEVEL_2_PAGE_TABLE_BITS + PAGE_OFFSET_BITS)) & 0xfffff) |
Definition at line 46 of file footprint_client2.cpp.
| #define LEVEL_2_PAGE_TABLE_BITS (12) |
Definition at line 42 of file footprint_client2.cpp.
| #define LEVEL_2_PAGE_TABLE_ENTRIES (1 << LEVEL_2_PAGE_TABLE_BITS) |
Definition at line 43 of file footprint_client2.cpp.
| #define LEVEL_2_PAGE_TABLE_SIZE (LEVEL_2_PAGE_TABLE_ENTRIES * PTR_SIZE) |
Definition at line 44 of file footprint_client2.cpp.
| #define LEVEL_2_PAGE_TABLE_SLOT | ( | addr | ) | (((addr) >> (PAGE_OFFSET_BITS)) & 0xFFF) |
Definition at line 47 of file footprint_client2.cpp.
| #define MAX_FOOTPRINT_CONTEXTS_TO_LOG (1000) |
Definition at line 52 of file footprint_client2.cpp.
| #define PAGE_OFFSET | ( | addr | ) | (addr & 0xFFFF) |
Definition at line 30 of file footprint_client2.cpp.
| #define PAGE_OFFSET_BITS (16LL) |
Definition at line 29 of file footprint_client2.cpp.
| #define PAGE_OFFSET_MASK (0xFFFF) |
Definition at line 31 of file footprint_client2.cpp.
| #define PAGE_SIZE (1 << PAGE_OFFSET_BITS) |
Definition at line 34 of file footprint_client2.cpp.
| #define PTR_SIZE (sizeof(void*)) |
Definition at line 37 of file footprint_client2.cpp.
| #define THREAD_MAX (1024) |
Definition at line 69 of file footprint_client2.cpp.
|
inline |
Definition at line 124 of file footprint_client2.cpp.
| void ClientInit | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 85 of file footprint_client2.cpp.
References gTraceFile, and MAX_FILE_PATH.
Referenced by main().
| void DecodingFootPrint | ( | const THREADID | threadid, |
| ContextHandle_t | myHandle, | ||
| ContextHandle_t | parentHandle, | ||
| void ** | myMetric, | ||
| void ** | parentMetric | ||
| ) |
Definition at line 185 of file footprint_client2.cpp.
References node_metric_t::addressSet, and node_metric_t::addressSetDecoded.
Referenced by ThreadFiniFunc().
| VOID FiniFunc | ( | INT32 | code, |
| VOID * | v | ||
| ) |
Definition at line 270 of file footprint_client2.cpp.
Referenced by main().
|
inline |
Definition at line 221 of file footprint_client2.cpp.
References sort_format_t::footprint.
Referenced by PrintTopFootPrintPath().
| uint8_t* GetOrCreateShadowBaseAddress | ( | uint64_t | address | ) |
Definition at line 112 of file footprint_client2.cpp.
References address, gL1PageTable, LEVEL_1_PAGE_TABLE_SLOT, LEVEL_2_PAGE_TABLE_SIZE, LEVEL_2_PAGE_TABLE_SLOT, and PAGE_SIZE.
Referenced by MemFunc().
| VOID InstrumentInsCallback | ( | INS | ins, |
| VOID * | v, | ||
| const uint32_t | slot | ||
| ) |
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 274 of file footprint_client2.cpp.
References ClientInit(), FiniFunc(), gTraceFile, InstrumentInsCallback(), INTERESTING_INS_MEMORY_ACCESS, PinCCTLib::PinCCTLibInit(), ThreadFiniFunc(), tv1, and Usage().
| VOID MemFunc | ( | THREADID | id, |
| void * | addr, | ||
| bool | rwFlag, | ||
| UINT32 | refSize | ||
| ) |
Definition at line 136 of file footprint_client2.cpp.
References PinCCTLib::GetContextHandle(), GetOrCreateShadowBaseAddress(), hmap_vector, PinCCTLib::metric, PAGE_OFFSET, PAGE_SIZE, and PinCCTLib::status.
Referenced by InstrumentInsCallback().
| void MergeFootPrint | ( | const THREADID | threadid, |
| ContextHandle_t | myHandle, | ||
| ContextHandle_t | parentHandle, | ||
| void ** | myMetric, | ||
| void ** | parentMetric | ||
| ) |
Definition at line 201 of file footprint_client2.cpp.
References node_metric_t::accessNum, node_metric_t::addressSet, node_metric_t::addressSetDecoded, node_metric_t::dependentNum, and hmap_vector.
Referenced by ThreadFiniFunc().
| void PrintTopFootPrintPath | ( | THREADID | threadid | ) |
Definition at line 225 of file footprint_client2.cpp.
References sort_format_t::accessNum, sort_format_t::dependentNum, sort_format_t::footprint, FootPrintCompare(), sort_format_t::fpNum, gTraceFile, sort_format_t::handle, hmap_vector, MAX_FOOTPRINT_CONTEXTS_TO_LOG, and PinCCTLib::PrintFullCallingContext().
Referenced by ThreadFiniFunc().
| VOID ThreadFiniFunc | ( | THREADID | threadid, |
| const CONTEXT * | ctxt, | ||
| INT32 | code, | ||
| VOID * | v | ||
| ) |
Definition at line 255 of file footprint_client2.cpp.
References DecodingFootPrint(), gTraceFile, MergeFootPrint(), PrintTopFootPrintPath(), tv1, tv2, and tv3.
Referenced by main().
|
static |
Definition at line 72 of file footprint_client2.cpp.
Referenced by main().
| uint8_t** gL1PageTable[LEVEL_1_PAGE_TABLE_SIZE] |
Definition at line 49 of file footprint_client2.cpp.
Referenced by GetOrCreateShadowBaseAddress().
| FILE* gTraceFile |
Definition at line 78 of file footprint_client2.cpp.
Referenced by ClientInit(), main(), PrintTopFootPrintPath(), and ThreadFiniFunc().
| unordered_map<uint32_t, struct node_metric_t> hmap_vector[THREAD_MAX] |
Definition at line 70 of file footprint_client2.cpp.
Referenced by MemFunc(), MergeFootPrint(), and PrintTopFootPrintPath().
| struct timeval tv1 |
Definition at line 78 of file footprint_client2.cpp.
Referenced by main(), and ThreadFiniFunc().
| __thread struct timeval tv2 |
Definition at line 81 of file footprint_client2.cpp.
Referenced by ThreadFiniFunc().
| __thread struct timeval tv3 |
Definition at line 82 of file footprint_client2.cpp.
Referenced by ThreadFiniFunc().