Re: sched_setscheduler() and usage issues ....please help

2005-03-30 Thread Arun Srinivas
When I schedule my process with SCHED_FIFO policy (using 
sched_setscheduler()) , is there any means to verify that it is indeed being 
scheduled with the same priority?

thanks
arun
From: Steven Rostedt <[EMAIL PROTECTED]>
To: Arun Srinivas <[EMAIL PROTECTED]>
Subject: Re: sched_setscheduler() and usage issues ....please help
Date: Tue, 29 Mar 2005 06:31:43 -0500
On Tue, 2005-03-29 at 13:25 +0530, Arun Srinivas wrote:
> thanks.gcc says "could not find strutils.h". I am using kernel 2.6.x 
with
> gcc 3.3.4. Where can I find the file?

Oops! Sorry, I gave you a modified version of my actual program. I have
my own usage wrapper, that I use in all my tools. I took it out, but
forgot about my header. That is a custom header, just take it out and it
will compile.
OK, just to be clean, I've attached it here.
-- Steve
<< setscheduler.c >>
_
Get the job you always wanted. 
http://www.naukri.com/tieups/tieups.php?othersrcp=736 Its simple, post your 
CV on Naukri.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sched_setscheduler() and usage issues ....please help

2005-03-29 Thread Jan Engelhardt
>FC2 has this. Even FC1 had it, and I'd not be surprised if even RHL9 had
>this. I'd be very susprised if SuSE 9.1 doesn't have it either.

It was introduced with SUSE Linux 9.1. But, as usually, I usually do not care 
for new packages when updating, and schedutils was not a dependency, so it 
lost itself until I actively checked what it's about when the boot process 
says
"Setting scheduling timeslicesunused"





Jan Engelhardt
-- 
No TOFU for me, please.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sched_setscheduler() and usage issues ....please help

2005-03-29 Thread Arjan van de Ven
On Tue, 2005-03-29 at 08:03 +0200, Jan Engelhardt wrote:
> >> > I am trying to set the SCHED_FIFO  policy for my process.I am using 
> >> > sched_setscheduler() function to do this.
> >> 
> >> Attached is a little program that I use to set the priority of tasks.
> >
> >Why not just use chrt from schedtools?
> 
> Not every distro has it yet, and I like to point out that a lot of users is 
> still using "older" distros, such as FC2, SUSE 9.1, and also olders with 
> Linux 
> 2.4 kernels

FC2 has this. Even FC1 had it, and I'd not be surprised if even RHL9 had
this. I'd be very susprised if SuSE 9.1 doesn't have it either.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sched_setscheduler() and usage issues ....please help

2005-03-29 Thread Jan Engelhardt
>OK, I'm a little embarrassed. I never saw this tool. I use debian

You don't need to be. Before I got to know of this tool, I also wrote my own.
Look for "schedutils".

>unstable, but didn't have the package loaded.  I did a apropos on
>sched_setscheduler, and it didn't come up with any tools, so I just
>wrote my own!



Jan Engelhardt
-- 
No TOFU for me, please.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sched_setscheduler() and usage issues ....please help

2005-03-29 Thread Steven Rostedt
On Tue, 2005-03-29 at 08:03 +0200, Jan Engelhardt wrote:
> >> > I am trying to set the SCHED_FIFO  policy for my process.I am using 
> >> > sched_setscheduler() function to do this.
> >> 
> >> Attached is a little program that I use to set the priority of tasks.
> >
> >Why not just use chrt from schedtools?
> 
> Not every distro has it yet, and I like to point out that a lot of users is 
> still using "older" distros, such as FC2, SUSE 9.1, and also olders with 
> Linux 
> 2.4 kernels.

OK, I'm a little embarrassed. I never saw this tool. I use debian
unstable, but didn't have the package loaded.  I did a apropos on
sched_setscheduler, and it didn't come up with any tools, so I just
wrote my own!

Thanks,

-- Steve


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sched_setscheduler() and usage issues ....please help

2005-03-28 Thread Jan Engelhardt
>> > I am trying to set the SCHED_FIFO  policy for my process.I am using 
>> > sched_setscheduler() function to do this.
>> 
>> Attached is a little program that I use to set the priority of tasks.
>
>Why not just use chrt from schedtools?

Not every distro has it yet, and I like to point out that a lot of users is 
still using "older" distros, such as FC2, SUSE 9.1, and also olders with Linux 
2.4 kernels.



Jan Engelhardt
-- 
No TOFU for me, please.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sched_setscheduler() and usage issues ....please help

2005-03-28 Thread Lee Revell
On Mon, 2005-03-28 at 23:40 -0500, Steven Rostedt wrote:
> On Tue, 2005-03-29 at 08:58 +0530, Arun Srinivas wrote:
> > I am trying to set the SCHED_FIFO  policy for my process.I am using 
> > sched_setscheduler() function to do this.
> 
> Attached is a little program that I use to set the priority of tasks.

Why not just use chrt from schedtools?

Lee

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sched_setscheduler() and usage issues ....please help

2005-03-28 Thread Steven Rostedt
On Tue, 2005-03-29 at 08:58 +0530, Arun Srinivas wrote:
> I am trying to set the SCHED_FIFO  policy for my process.I am using 
> sched_setscheduler() function to do this.

Attached is a little program that I use to set the priority of tasks.

-- Steve
/* Copyright (C) 2004 Kihon Technologies Inc.

   This utilities is free software, you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   These utilities are distributed in the hope that they will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */
/*
 * Author: Steven Rostedt
 */
#include 
#include 
#include 
#include 
#include 
#include 

void usage (char **argv)
{
	char *arg = argv[0];
	char *p = arg + strlen(arg);
	while (p >= arg && *p != '/') p--;
	p++;
	fprintf(stderr,"usage: %s pid policy priority\n"
			"\n\twhere policy is SCHED_RR, SCHED_FIFO or SCHED_OTHER\n"
			"\n", p);
	exit(-1);
}

int main (int argc, char **argv)
{
	pid_t pid;
	int policy;
	struct sched_param p;
	char *strpolicy;
	
	if (argc != 4)
		usage(argv);

	strpolicy = argv[2];
	pid = atoi(argv[1]);
	p.sched_priority = atoi(argv[3]);

	if (strcmp(strpolicy,"SCHED_RR")==0) {
		policy = SCHED_RR;
	} else if (strcmp(strpolicy,"SCHED_FIFO") == 0) {
		policy = SCHED_FIFO;
	} else if (strcmp(strpolicy,"SCHED_OTHER") == 0) {
		policy = SCHED_OTHER;
	} else {
		fprintf(stderr,"\nunknown policy %s",strpolicy);
		usage(argv);
	}

	if (sched_setscheduler(pid,policy,&p)) {
		perror("sched_setscheduler");
		exit(errno);
	}
	exit(0);
}