Skip to content

Instantly share code, notes, and snippets.

@Kalinovcic
Kalinovcic / nt_profile_cache_miss.cpp
Created September 7, 2018 17:22
Some code using undocumented NT profiling functions to count LLC misses. I don't know how accurate it is, haven't used it for anything yet.
typedef enum _KPROFILE_SOURCE
{
ProfileTime = 0x00,
ProfileTotalIssues = 0x02,
ProfileBranchInstructions = 0x06,
ProfileCacheMisses = 0x0A,
ProfileBranchMispredictions = 0x0B,
ProfileTotalCycles = 0x13,
ProfileUnhaltedCoreCycles = 0x19,
ProfileInstructionRetired = 0x1A,
//
// Author: Jonathan Blow
// Version: 1
// Date: 31 August, 2018
//
// This code is released under the MIT license, which you can find at
//
// https://opensource.org/licenses/MIT
//
//
@Kalinovcic
Kalinovcic / .git$hooks$pre-commit
Last active May 22, 2021 13:59
Sublime Text files: C++ syntax and theme. The $ characters in filenames represent subdirectories.
#!/bin/bash
ok="1"
staged=$(git diff --name-only --cached)
for file in ${staged}; do
if grep -q -E 'nocheckin' ${file}; then
git reset ${file}
echo "nocheckin: ${file}"
ok="0"