Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Util/Clooper
diff options
context:
space:
mode:
authorJames <olpc@localhost.localdomain>2007-02-21 09:35:16 (GMT)
committer James <olpc@localhost.localdomain>2007-02-21 09:35:16 (GMT)
commit35fdf3ba130c95f2528b38b54f6e4c9448540f4c (patch)
treed0ba682222aa11abbd9c1c49c89f4879c55c649b /Util/Clooper
parent7dfc38a9d32551c45ac4d1b74c22c56e8ffe9c16 (diff)
adding self-scheduler
Diffstat (limited to 'Util/Clooper')
-rw-r--r--Util/Clooper/aclient.cpp22
-rwxr-xr-xUtil/Clooper/aclient.sobin231082 -> 234016 bytes
2 files changed, 21 insertions, 1 deletions
diff --git a/Util/Clooper/aclient.cpp b/Util/Clooper/aclient.cpp
index f53655a..d5da736 100644
--- a/Util/Clooper/aclient.cpp
+++ b/Util/Clooper/aclient.cpp
@@ -5,6 +5,7 @@
#include <time.h>
#include <unistd.h>
#include <sys/time.h>
+#include <sched.h>
#include <vector>
#include <map>
@@ -18,7 +19,7 @@
unsigned int SAMPLE_RATE = 16000;
-snd_pcm_uframes_t PERIODS_PER_BUFFER = 4;
+snd_pcm_uframes_t PERIODS_PER_BUFFER = 2;
snd_pcm_uframes_t PERIOD_SIZE = (1<<8);
static int setparams (snd_pcm_t * phandle )
@@ -52,6 +53,23 @@ static int setswparams(snd_pcm_t *phandle)
return 0;
}
+static void setscheduler(void)
+{
+ struct sched_param sched_param;
+
+ if (sched_getparam(0, &sched_param) < 0) {
+ printf("Scheduler getparam failed...\n");
+ return;
+ }
+ sched_param.sched_priority = sched_get_priority_max(SCHED_RR);
+ if (!sched_setscheduler(0, SCHED_RR, &sched_param)) {
+ printf("Scheduler set to Round Robin with priority %i...\n", sched_param.sched_priority);
+ fflush(stdout);
+ return;
+ }
+ printf("!!!Scheduler set to Round Robin with priority %i FAILED!!!\n", sched_param.sched_priority);
+}
+
static double pytime(const struct timeval * tv)
{
return (double) tv->tv_sec + (double) tv->tv_usec / 1000000.0;
@@ -390,6 +408,8 @@ struct TamTamSound
buf[i*2] = buf[i*2+1] = 0.5 * sin( i / (float)nframes * 10.0 * M_PI);
}
+ setscheduler();
+
while (PERF_STATUS == CONTINUE)
{
int err = 0;
diff --git a/Util/Clooper/aclient.so b/Util/Clooper/aclient.so
index c5d422e..42caa9b 100755
--- a/Util/Clooper/aclient.so
+++ b/Util/Clooper/aclient.so
Binary files differ