forked from fmadio/pcap_flow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfProfile.c
More file actions
51 lines (45 loc) · 1.02 KB
/
Copy pathfProfile.c
File metadata and controls
51 lines (45 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//---------------------------------------------------------------------------------------------
//
// Copyright (c) 2015, fmad engineering llc
//
// quick and dirty profiling
//
//---------------------------------------------------------------------------------------------
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/shm.h>
#include "fTypes.h"
#include "fProfile.h"
u64 g_ProfileStart[32];
u64 g_ProfileStop[32];
u64 g_ProfileTotal[32];
char* g_ProfileDesc[32];
void fProfile_Reset(void)
{
for (int i=0; i < 16; i++)
{
g_ProfileStart [i] = 0;
g_ProfileStop [i] = 0;
g_ProfileTotal [i] = 0;
}
}
void fProfile_Dump(u32 Index)
{
double oot = 1.0 / g_ProfileTotal[Index];
for (int i=0; i < 16; i++)
{
fprintf(stderr, " [%2i] %016llx %20lli : (%.4f) : %s\n",
i,
g_ProfileTotal[i],
g_ProfileTotal[i],
g_ProfileTotal[i] * oot,
g_ProfileDesc[i]);
}
fProfile_Reset();
}