Skip to content

Commit

Permalink
Move count_spes() to hw.h
Browse files Browse the repository at this point in the history
- we may need it for other tests.

Signed-off-by: Jeremy Kerr <[email protected]>
  • Loading branch information
jk-ozlabs committed Mar 4, 2009
1 parent 696b167 commit 40958e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
16 changes: 16 additions & 0 deletions lib/include/test/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,23 @@
#ifndef TEST_HW_H
#define TEST_HW_H

#include <sys/stat.h>

#define LS_SIZE 0x40000
#define PSMAP_SIZE 0x20000

#define PSMAP_SIGNAL1_OFFSET 0x1400c
#define PSMAP_SIGNAL2_OFFSET 0x1c00c

static inline int count_spes(void)
{
struct stat statbuf;
int rc;

rc = stat("/sys/devices/system/spu", &statbuf);
assert(!rc);

return statbuf.st_nlink - 2;
}

#endif /* TEST_HW_H */
12 changes: 0 additions & 12 deletions tests/04-context/03-consume-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
#include <assert.h>
Expand All @@ -37,17 +36,6 @@

/* create two processes to run contexts on all SPEs */

static int count_spes(void)
{
struct stat statbuf;
int rc;

rc = stat("/sys/devices/system/spu", &statbuf);
assert(!rc);

return statbuf.st_nlink - 2;
}

#if 0
.long 0x0
.long 0x0
Expand Down

0 comments on commit 40958e8

Please sign in to comment.