Skip to content

Instantly share code, notes, and snippets.

View dmarion's full-sized avatar

Damjan Marion dmarion

  • Rijeka, Croatia
View GitHub Profile
@dmarion
dmarion / perf.c
Last active April 13, 2022 09:42
Sample perf measurement with vppinfra perfmon
#if 0
clang \
-g \
-march=native \
-O3 \
-Isrc \
-Llib/x86_64-linux-gnu \
-Wl,-rpath ./lib/x86_64-linux-gnu \
"$0" \
-lvppinfra \
@dmarion
dmarion / b.c
Last active October 13, 2021 12:41
#include <vppinfra/clib.h>
#include <vppinfra/vector.h>
#include <vppinfra/string.h>
#include <vppinfra/random.h>
#include <iacaMarks.h>
#include </home/damarion/cisco/vpp-sandbox/include/tscmarks.h>
void __clib_noinline __clib_section (".ver1")
ver1 (u8 *dst, const u8 *src, size_t n)
{
#include <stdio.h>
#include <sys/mman.h>
#include <x86intrin.h>
int main() {
void *p = (void *)0x100000000ULL;
__m512i v, zero = {};
p = mmap(p, 4096, PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_POPULATE | MAP_ANONYMOUS, -1, 0);
printf("p = %p\n", p);
#!/usr/bin/env python3
import sys, argparse, ezdxf, os
from xml.dom import minidom
from pprint import pprint
types = "POINT,LINE,POLYLINE,LWPOLYLINE"
p = argparse.ArgumentParser(description='dxf2gml')
p.add_argument('-i', '--input', action='store', help='input filename (DXF)', required = True)
p.add_argument('-o', '--output', action='store', help='output filename (GML)', required = True)
p.add_argument('-l', '--layers', action='store', help='coma separatted list of layers')
#!/usr/bin/env python3
import sys, argparse, ezdxf, os
from xml.dom import minidom
from pprint import pprint
p = argparse.ArgumentParser(description='dxf2gml')
p.add_argument('-i', '--input', action='store', help='input filename (DXF)', required = True)
p.add_argument('-o', '--output', action='store', help='output filename (GML)', required = True)
p.add_argument('-l', '--layers', action='store', help='coma separatted list of layers')
p.add_argument('-t', '--type', action='store', help='coma separatted list of object types [POINT, LWPOLYLINE]')
#include <stdio.h>
#include <stddef.h>
#include <syscall.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <x86intrin.h>
typedef unsigned long u64;

startup.vpp

trace add avf-input 50
pipe create
create interface avf 0000:86:02.0 name eth0
create interface avf 0000:86:0a.0 name eth1

ip table add 1
set int ip table eth1 1
@dmarion
dmarion / vppinc.h
Created March 27, 2019 08:14
vppinc.h
#include <x86intrin.h>
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
#define _(x) __attribute__((vector_size (x)))
typedef u8 u8x32 _(32);
typedef u16 u16x16 _(32);
#!/bin/bash
if [ ! -d boot ] ; then
PKG=$(apt-cache depends -i linux-image-kvm | grep Depends: | cut -d: -f2)
apt-get download ${PKG}
dpkg --fsys-tarfile ${PKG}_*.deb | tar xvf - ./boot
echo $PKG
fi
TESTPMD_BIN=${HOME}/src/dpdk/x86_64-native-linuxapp-gcc/app/testpmd
#include <tscmarks.h>
#include <vppinfra/bihash_24_8.h>
#include <vppinfra/bihash_template.h>
#include <vppinfra/mem.h>
#include <vppinfra/bihash_template.c>
#define NUM_BUCKETS (1 << 24)
#define N_ELTS (100 * 1000 * 1000)
#define MEM_SIZE (16ULL << 30)