Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169516
b: refs/heads/master
c: 5a116dd
h: refs/heads/master
v: v3
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Oct 19, 2009
1 parent 1d8bbcb commit 18c8c39
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 11018201b831e19304c0d639f105ad6c27e120b1
refs/heads/master: 5a116dd2797677cad48fee2f42267e3cb69f5502
16 changes: 16 additions & 0 deletions trunk/tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ LIB_OBJS += util/parse-options.o
LIB_OBJS += util/parse-events.o
LIB_OBJS += util/path.o
LIB_OBJS += util/rbtree.o
LIB_OBJS += util/bitmap.o
LIB_OBJS += util/hweight.o
LIB_OBJS += util/find_next_bit.o
LIB_OBJS += util/run-command.o
LIB_OBJS += util/quote.o
LIB_OBJS += util/strbuf.o
Expand Down Expand Up @@ -790,6 +793,19 @@ util/config.o: util/config.c PERF-CFLAGS
util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<

# some perf warning policies can't fit to lib/bitmap.c, eg: it warns about variable shadowing
# from <string.h> that comes from kernel headers wrapping.
KBITMAP_FLAGS=`echo $(ALL_CFLAGS) | sed s/-Wshadow// | sed s/-Wswitch-default// | sed s/-Wextra//`

util/bitmap.o: ../../lib/bitmap.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o util/bitmap.o -c $(KBITMAP_FLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<

util/hweight.o: ../../lib/hweight.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o util/hweight.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<

util/find_next_bit.o: ../../lib/find_next_bit.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o util/find_next_bit.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<

perf-%$X: %.o $(PERFLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)

Expand Down
3 changes: 0 additions & 3 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
#include <unistd.h>
#include <sched.h>

#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))

static int fd[MAX_NR_CPUS][MAX_COUNTERS];

static long default_interval = 0;
Expand Down
2 changes: 0 additions & 2 deletions trunk/tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ static int cwdlen;
#define PR_SET_NAME 15 /* Set process name */
#define MAX_CPUS 4096

#define BUG_ON(x) assert(!(x))

static u64 run_measurement_overhead;
static u64 sleep_measurement_overhead;

Expand Down
6 changes: 6 additions & 0 deletions trunk/tools/perf/util/include/asm/bitops.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "../../../../include/asm-generic/bitops/__fls.h"
#include "../../../../include/asm-generic/bitops/fls.h"
#include "../../../../include/asm-generic/bitops/fls64.h"
#include "../../../../include/asm-generic/bitops/__ffs.h"
#include "../../../../include/asm-generic/bitops/ffz.h"
#include "../../../../include/asm-generic/bitops/hweight.h"
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/include/asm/byteorder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "../asm/types.h"
#include "../../../../include/linux/swab.h"
1 change: 1 addition & 0 deletions trunk/tools/perf/util/include/asm/swab.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* stub */
17 changes: 17 additions & 0 deletions trunk/tools/perf/util/include/asm/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef PERF_ASM_TYPES_H_
#define PERF_ASM_TYPES_H_

#include <linux/compiler.h>
#include "../../types.h"
#include <sys/types.h>

/* CHECKME: Not sure both always match */
#define BITS_PER_LONG __WORDSIZE

typedef u64 __u64;
typedef u32 __u32;
typedef u16 __u16;
typedef u8 __u8;
typedef s64 __s64;

#endif /* PERF_ASM_TYPES_H_ */
14 changes: 14 additions & 0 deletions trunk/tools/perf/util/include/asm/uaccess.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef _PERF_ASM_UACCESS_H_
#define _PERF_ASM_UACCESS_H_

#define __get_user(src, dest) \
({ \
(src) = *dest; \
0; \
})

#define get_user __get_user

#define access_ok(type, addr, size) 1

#endif
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/include/linux/bitmap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "../../../../include/linux/bitmap.h"
#include "../../../../include/asm-generic/bitops/find.h"
27 changes: 27 additions & 0 deletions trunk/tools/perf/util/include/linux/bitops.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef _PERF_LINUX_BITOPS_H_
#define _PERF_LINUX_BITOPS_H_

#define __KERNEL__

#define CONFIG_GENERIC_FIND_NEXT_BIT
#define CONFIG_GENERIC_FIND_FIRST_BIT
#include "../../../../include/linux/bitops.h"

static inline void set_bit(int nr, unsigned long *addr)
{
addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
}

static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
{
return ((1UL << (nr % BITS_PER_LONG)) &
(((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0;
}

unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned
long size, unsigned long offset);

unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned
long size, unsigned long offset);

#endif
10 changes: 10 additions & 0 deletions trunk/tools/perf/util/include/linux/compiler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef _PERF_LINUX_COMPILER_H_
#define _PERF_LINUX_COMPILER_H_

#ifndef __always_inline
#define __always_inline inline
#endif
#define __user
#define __attribute_const__

#endif
1 change: 1 addition & 0 deletions trunk/tools/perf/util/include/linux/ctype.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../include/linux/ctype.h"
59 changes: 59 additions & 0 deletions trunk/tools/perf/util/include/linux/kernel.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#ifndef PERF_LINUX_KERNEL_H_
#define PERF_LINUX_KERNEL_H_

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))

#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))

#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
Expand All @@ -26,4 +36,53 @@
_max1 > _max2 ? _max1 : _max2; })
#endif

#ifndef min
#define min(x, y) ({ \
typeof(x) _min1 = (x); \
typeof(y) _min2 = (y); \
(void) (&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; })
#endif

#ifndef BUG_ON
#define BUG_ON(cond) assert(!(cond))
#endif

/*
* Both need more care to handle endianness
* (Don't use bitmap_copy_le() for now)
*/
#define cpu_to_le64(x) (x)
#define cpu_to_le32(x) (x)

static inline int
vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
{
int i;
ssize_t ssize = size;

i = vsnprintf(buf, size, fmt, args);

return (i >= ssize) ? (ssize - 1) : i;
}

static inline int scnprintf(char * buf, size_t size, const char * fmt, ...)
{
va_list args;
ssize_t ssize = size;
int i;

va_start(args, fmt);
i = vsnprintf(buf, size, fmt, args);
va_end(args);

return (i >= ssize) ? (ssize - 1) : i;
}

static inline unsigned long
simple_strtoul(const char *nptr, char **endptr, int base)
{
return strtoul(nptr, endptr, base);
}

#endif
1 change: 1 addition & 0 deletions trunk/tools/perf/util/include/linux/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* stub */

0 comments on commit 18c8c39

Please sign in to comment.