Date: Tue, 12 Jan 2016 13:02:26 -0800 From: "darwinsurvivor@gmail.com" <darwinsurvivor@gmail.com> To: Ian Smith <smithi@nimnet.asn.au> Cc: kpneal@pobox.com, "William A. Mahaffey III" <wam@hiwaay.net>, freebsd-questions@freebsd.org Subject: Re: Task to busy one CPU 100% for a period of time? Message-ID: <CAMuYtRDoKfGC0awAon1%2BBmUKsj6ugau-umgzCiR8MpbA37QTgQ@mail.gmail.com> In-Reply-To: <20160113052558.R93547@sola.nimnet.asn.au> References: <20160111002439.Q93547@sola.nimnet.asn.au> <56928802.2040802@hiwaay.net> <20160111154616.G93547@sola.nimnet.asn.au> <20160111203832.GC88498@neutralgood.org> <20160113052558.R93547@sola.nimnet.asn.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Have you looked at the sysutils/stress utility? It may do what you need. ~Doug On Tue, Jan 12, 2016 at 10:36 AM, Ian Smith <smithi@nimnet.asn.au> wrote: > On Mon, 11 Jan 2016 15:38:32 -0500, kpneal@pobox.com wrote: > > On Mon, Jan 11, 2016 at 04:04:05PM +1100, Ian Smith wrote: > > > Thanks for your response. However I don't do C, and really need to > find > > > something out of the box that I can configure to run at 100% of one > CPU > > > for a specified number of iterations, which will then run for a > certain > > > amount of CPU time on my hardware, while always on the run queue. > > > > Won't this reproduce your results? > > > > Two compilations: > > > > /* main.c */ > > int main() { > > for (;;) > > dummy_function(); > > /*NOTREACHED*/ > > return(0); > > } > > > > /* dummy.c */ > > int dummy_function(void) { > > return 0; > > } > > > > cc -c main.c > > cc -c dummy.c > > cc -o load1 main.o dummy.o > > > > One invocation of this program should consume an entire CPU and > therefore > > raise the load average by 1.00. Run as many as you like. > > > > (The reason for the two compilations is to avoid having any compiler > > optimize away the for loop. Just to be safe.) > > Thankyou Kevin. Works a treat, so far tested 8 at once, loadavg = 8.00 > > I'll follow up hopefully tomorrow with results of a sh script to run a > given number of instances for a given time, needing a bit more testing. > > cheers, Ian > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMuYtRDoKfGC0awAon1%2BBmUKsj6ugau-umgzCiR8MpbA37QTgQ>