Skip to content

Instantly share code, notes, and snippets.

View mfleming's full-sized avatar

Matt Fleming mfleming

View GitHub Profile
//
// Compile with:
//
// g++ clear_user.cc -std=c++11 -isystem <path to googlebenchmark>/include \
// -L<path to googlebenchmark>/build/src -lbenchmark -lpthread -o clear_user
//
#include <benchmark/benchmark.h>
#define BUF_SIZE (64*1024)
/*
* Copyright 2020 Matt Fleming
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mfleming
mfleming / nop.c
Last active May 31, 2017 11:23
LMBench nop
void
do_int64_mul(unsigned int iterations, unsigned int N)
{
int64_t r = (int64_t)N + 37420;
r += (int64_t)(N + 6)<<32;
while (iterations-- > 0)
;
use_int((int)r);
@mfleming
mfleming / foo.c
Last active May 29, 2017 20:42
LMBench ops model example
#include <stdint.h>
#define TEN(a) a a a a a a a a a a
static volatile uint64_t use_result_dummy;
void
use_int(int result) { use_result_dummy += result; }
void
do_int64_mul(unsigned int iterations, unsigned int N)
diff -r 02bc14ed1569 mh.c
--- a/mh.c Tue Dec 08 09:12:09 2015 -0800
+++ b/mh.c Sun Jan 15 21:35:48 2017 +0000
@@ -1908,6 +1908,7 @@
struct maildir *md; /* list of messages in the mailbox */
struct maildir **last, *p;
int i;
+ int count = 0;
HASH *fnames; /* hash table for quickly looking up the base filename
for a maildir message */
struct grub_cpu_idt_descriptor
{
grub_uint16_t limit;
grub_uint32_t base;
} __attribute__ ((packed));
static struct grub_cpu_idt_descriptor no_idt __attribute__((aligned(16)));
/* The main routine. */
void __attribute__ ((noreturn))
diff --git a/scripts/runqemu b/scripts/runqemu
index b1d2d1a..aa8a8b9 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -494,13 +494,13 @@ fi
# Specify directory for BIOS, VGA BIOS and keymaps
if [ ! -z "$CUSTOMBIOSDIR" ]; then
- if [ -d "$OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" ]; then
- echo "Assuming biosdir is $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"