rpms/seeker/devel import.log, NONE, 1.1 seeker.LICENSE, NONE, 1.1 seeker.spec, NONE, 1.1 seeker_baryluk.c, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
Ville Skyttä
scop at fedoraproject.org
Tue Sep 15 06:06:56 UTC 2009
Author: scop
Update of /cvs/pkgs/rpms/seeker/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24898/devel
Modified Files:
.cvsignore sources
Added Files:
import.log seeker.LICENSE seeker.spec seeker_baryluk.c
Log Message:
Initial import (#520701).
--- NEW FILE import.log ---
seeker-3_0-2_fc11:HEAD:seeker-3.0-2.fc11.src.rpm:1252994774
--- NEW FILE seeker.LICENSE ---
http://www.linuxinsight.com/how_fast_is_your_disk.html?page=1#comment-971
ChangeLog, AUTHORS, TODO...
Submitted by admin on Wed, 2007-01-17 20:39.
Well, I don't have plans to make this a full blown package at this
time, because of the utter lack of free time, sorry. But in time, yes,
why not. The trigger event could be when I have time to make it
multithreaded. Then it should become much more useful.
In the meantime, put this on the top of seeker.c:
# Seeker v2.0, 2007-01-15, by linportal at gmail.com
# http://www.linuxinsight.com/how_fast_is_your_disk.html
# Distributed under the terms of the GNU General Public License v2
And then you can do whatever you like with it. If it's not against GPL
rules, of course. ;)
--- NEW FILE seeker.spec ---
Name: seeker
Version: 3.0
Release: 2%{?dist}
Summary: Random access disk benchmark utility
Group: Applications/System
License: GPLv2 and CC-BY-SA
URL: http://www.linuxinsight.com/how_fast_is_your_disk.html
# http://www.linuxinsight.com/how_fast_is_your_disk.html#comment-1583
Source0: http://smp.if.uj.edu.pl/~baryluk/seeker_baryluk.c
# http://www.linuxinsight.com/how_fast_is_your_disk.html?page=1#comment-971
Source1: %{name}.LICENSE
# Grabbed with firefox, modified, ran through tidy(1) per CC BY-SA 2.5:
# http://www.linuxinsight.com/about.html
Source2: %{name}-docs.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
Seeker is a simple utility that reads small pieces of data from a raw
disk device in a random access pattern, and reports the average number
of seeks per second, and calculated random access time of the disk.
The seeker variant included in this package is the multithreaded one
by Witold Baryluk.
%prep
%setup -q -c -T -a 2
install -pm 644 %{SOURCE0} $(basename %{SOURCE0}) # for debuginfo
cp -p %{SOURCE1} LICENSE
%build
%{__cc} $RPM_OPT_FLAGS -pthread $(basename %{SOURCE0}) -o seeker
%install
rm -rf $RPM_BUILD_ROOT
install -Dpm 755 seeker $RPM_BUILD_ROOT%{_sbindir}/seeker
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc LICENSE how_fast_is_your_disk*
%{_sbindir}/seeker
%changelog
* Sun Sep 13 2009 Ville Skyttä <ville.skytta at iki.fi> - 3.0-2
- Address review comments (#520701):
- Improve %%description.
- Include upstream article in docs.
* Fri Aug 28 2009 Ville Skyttä <ville.skytta at iki.fi> - 3.0-1
- First build.
--- NEW FILE seeker_baryluk.c ---
#define _LARGEFILE64_SOURCE
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <signal.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
#define BLOCKSIZE 512
#define TIMEOUT 30
pthread_mutex_t muteks = PTHREAD_MUTEX_INITIALIZER;
int count;
time_t start;
off64_t maxoffset = 0;
off64_t minoffset = 249994674176000uLL;
int threads;
typedef struct {
int id;
int fd;
int run;
char* filename;
unsigned int seed;
unsigned long long numbytes;
char* buffer;
int count;
off64_t maxoffset;
off64_t minoffset;
} parm;
parm *p;
void done() {
int i;
time_t end;
time(&end);
if (end < start + TIMEOUT) {
printf(".");
alarm(1);
return;
}
for (i = 0; i < threads; i++) {
p[i].run = 0;
}
}
void report() {
if (count) {
printf(".\nResults: %d seeks/second, %.3f ms random access time (%llu < offsets < %llu)\n",
count / TIMEOUT, 1000.0 * TIMEOUT / count, (unsigned long long)minoffset, (unsigned long long)maxoffset);
}
exit(EXIT_SUCCESS);
}
void handle(const char *string, int error) {
if (error) {
perror(string);
exit(EXIT_FAILURE);
}
}
void* f(void *arg) {
int retval;
off64_t offset;
parm *p = (parm*)arg;
srand(p->seed);
/* wait for all processes */
pthread_mutex_lock(&muteks);
pthread_mutex_unlock(&muteks);
while (p->run) {
offset = (off64_t) ( (unsigned long long) (p->numbytes * (rand_r(&(p->seed)) / (RAND_MAX + 1.0) )));
//printf("%d %llu\n", p->id, (unsigned long long )offset);
retval = lseek64(p->fd, offset, SEEK_SET);
handle("lseek64", retval == (off64_t) -1);
retval = read(p->fd, p->buffer, BLOCKSIZE);
handle("read", retval < 0);
p->count++;
if (offset > p->maxoffset) {
p->maxoffset = offset;
} else if (offset < p->minoffset) {
p->minoffset = offset;
}
}
//pthread_exit(NULL);
return NULL;
}
int main(int argc, char **argv) {
int fd, retval;
int physical_sector_size = 0;
size_t logical_sector_size = 0ULL;
unsigned long long numblocks, numbytes;
unsigned long long ull;
unsigned long ul;
pthread_t *t_id;
pthread_attr_t pthread_custom_attr;
int i;
setvbuf(stdout, NULL, _IONBF, 0);
printf("Seeker v3.0, 2009-06-17, "
"http://www.linuxinsight.com/how_fast_is_your_disk.html\n");
if (!(argc == 2 || argc == 3)) {
printf("Usage: %s device [threads]\n", argv[0]);
exit(1);
}
threads = 1;
if (argc == 3) {
threads = atoi(argv[2]);
}
//pthread_mutex_init(&muteks, NULL);
fd = open(argv[1], O_RDONLY | O_LARGEFILE);
handle("open", fd < 0);
#ifdef BLKGETSIZE64
retval = ioctl(fd, BLKGETSIZE64, &ull);
numbytes = (unsigned long long)ull;
#else
retval = ioctl(fd, BLKGETSIZE, &ul);
numbytes = (unsigned long long)ul;
#endif
handle("ioctl", retval == -1);
retval = ioctl(fd, BLKBSZGET, &logical_sector_size);
handle("ioctl", retval == -1 && logical_sector_size > 0);
retval = ioctl(fd, BLKSSZGET, &physical_sector_size);
handle("ioctl", retval == -1 && physical_sector_size > 0);
numblocks = ((unsigned long long)numbytes)/(unsigned long long)BLOCKSIZE;
printf("Benchmarking %s [%llu blocks, %llu bytes, %llu GB, %llu MB, %llu GiB, %llu MiB]\n",
argv[1], numblocks, numbytes, numbytes/(1024uLL*1024uLL*1024uLL), numbytes / (1024uLL*1024uLL), numbytes/(1000uLL*1000uLL*1000uLL), numbytes / (1000uLL*1000uLL));
printf("[%d logical sector size, %d physical sector size]\n", physical_sector_size, physical_sector_size);
printf("[%d threads]\n", threads);
printf("Wait %d seconds", TIMEOUT);
t_id = (pthread_t *)malloc(threads*sizeof(pthread_t));
handle("malloc", t_id == NULL);
pthread_attr_init(&pthread_custom_attr);
p = (parm *)malloc(sizeof(parm)*threads);
handle("malloc", p == NULL);
time(&start);
pthread_mutex_lock(&muteks);
srand((unsigned int)start*(unsigned int)getpid());
for (i = 0; i < threads; i++) {
p[i].id = i;
p[i].filename = argv[1];
p[i].seed = rand()+i;
p[i].fd = dup(fd);
handle("dup", p[i].fd < 0);
p[i].buffer = malloc(sizeof(char)*BLOCKSIZE);
p[i].numbytes = numbytes;
handle("malloc", p[i].buffer == NULL);
p[i].run = 1;
p[i].count = 0;
p[i].minoffset = minoffset;
p[i].maxoffset = maxoffset;
retval = pthread_create(&(t_id[i]), NULL, f, (void*)(p+i));
handle("pthread_create", retval != 0);
}
sleep(1);
time(&start);
signal(SIGALRM, &done);
alarm(1);
pthread_mutex_unlock(&muteks);
for (i = 0; i < threads; i++) {
pthread_join(t_id[i], NULL);
}
for (i = 0; i < threads; i++) {
count += p[i].count;
if (p[i].maxoffset > maxoffset) {
maxoffset = p[i].maxoffset;
}
if (p[i].minoffset < minoffset) {
minoffset = p[i].minoffset;
}
}
report();
/* notreached */
return 0;
}
Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/seeker/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- .cvsignore 14 Sep 2009 21:36:50 -0000 1.1
+++ .cvsignore 15 Sep 2009 06:06:55 -0000 1.2
@@ -0,0 +1 @@
+seeker-docs.tar.gz
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/seeker/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- sources 14 Sep 2009 21:36:50 -0000 1.1
+++ sources 15 Sep 2009 06:06:56 -0000 1.2
@@ -0,0 +1 @@
+b169f93946dd18a46f4f63f71a2229fc seeker-docs.tar.gz
More information about the fedora-extras-commits
mailing list