FreeBSD Bugzilla – Attachment 114403 Details for
Bug 156064
new port: sysutils/cpulimit -- a program to throttle process CPU usage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.shar
file.shar (text/plain), 3.97 KB, created by
Jesse
on 2011-03-30 18:30:11 UTC
(
hide
)
Description:
file.shar
Filename:
MIME Type:
Creator:
Jesse
Created:
2011-03-30 18:30:11 UTC
Size:
3.97 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># cpulimit ># cpulimit/Makefile ># cpulimit/pkg-descr ># cpulimit/distinfo ># cpulimit/files ># cpulimit/files/patch-makefile ># cpulimit/files/patch-cpulimit.c ># >echo c - cpulimit >mkdir -p cpulimit > /dev/null 2>&1 >echo x - cpulimit/Makefile >sed 's/^X//' >cpulimit/Makefile << 'd4cb032bbe6802f3bc73aa51eb695ab4' >X# New ports collection makefile for: cpulimit >X# Date created: April 1, 2011 >X# Whom: Jesse >X# >X# $FreeBSD: ports/ftp/bftpd/Makefile,v 1.36 2011/02/10 11:51:01 sylvio Exp $ >X# >X >XPORTNAME= cpulimit >XPORTVERSION= 1.1 >XCATEGORIES= sysutils >XMASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTNAME}/ >X >XMAINTAINER= jessefrgsmith@yahoo.ca >XCOMMENT= A program to limit the CPU usage of a process. >X >XPLIST_FILES= bin/${PORTNAME} >X >X >Xdo-install: >X ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin/ >X.if !defined(NOPORTDOCS) >X.endif >X >X.include <bsd.port.mk> >d4cb032bbe6802f3bc73aa51eb695ab4 >echo x - cpulimit/pkg-descr >sed 's/^X//' >cpulimit/pkg-descr << '352c81b5f2774ebdda2676e8d6866d5c' >XThe cpulimit program throttles back a process's CPU usage. This allows the >Xuser to slow down jobs that would otherwise choke the processor. It is also helpful on laptops where we want to avoid genrating a lot of heat. >X >XWWW: http://cpulimit.sourceforge.net/ >352c81b5f2774ebdda2676e8d6866d5c >echo x - cpulimit/distinfo >sed 's/^X//' >cpulimit/distinfo << 'c4f5f1e36ace754d032d49df67aa1f0a' >XSHA256 (cpulimit-1.1.tar.gz) = ee734e82692dc496a083c003340b326bd779567f5de99fcae99e451606c85c00 >XSIZE (cpulimit-1.1.tar.gz) = 5130 >c4f5f1e36ace754d032d49df67aa1f0a >echo c - cpulimit/files >mkdir -p cpulimit/files > /dev/null 2>&1 >echo x - cpulimit/files/patch-makefile >sed 's/^X//' >cpulimit/files/patch-makefile << '9bcfc841f4fe28e1b7760995d0d88429' >X--- Makefile.old 2005-06-24 07:53:43.000000000 -0300 >X+++ Makefile 2010-08-21 15:10:45.000000000 -0300 >X@@ -1,7 +1,15 @@ >X+PREFIX=/usr/local >X+ >X all:: cpulimit >X >X cpulimit: cpulimit.c >X- gcc -o cpulimit cpulimit.c -lrt -Wall -O2 >X+ gcc -o cpulimit cpulimit.c -lrt -Wall -O2 -lkvm >X+ >X+install: cpulimit >X+ cp cpulimit ${PREFIX}/bin >X+ >X+deinstall: >X+ rm -f ${PREFIX}/bin/cpulimit >X >X clean: >X rm -f *~ cpulimit >9bcfc841f4fe28e1b7760995d0d88429 >echo x - cpulimit/files/patch-cpulimit.c >sed 's/^X//' >cpulimit/files/patch-cpulimit.c << '8968e897a9353cfafcbb2d493c1807bf' >X--- cpulimit.c.orig 2010-08-20 19:35:15.000000000 -0300 >X+++ cpulimit.c 2010-08-21 14:17:52.000000000 -0300 >X@@ -43,6 +43,15 @@ >X #include <errno.h> >X #include <string.h> >X >X+#include <limits.h> >X+#include <fcntl.h> >X+#include <kvm.h> >X+#include <paths.h> >X+#include <sys/param.h> >X+#include <sys/sysctl.h> >X+#include <sys/user.h> >X+ >X+ >X //kernel time resolution (inverse of one jiffy interval) in Hertz >X //i don't know how to detect it, then define to the default (not very clean!) >X #define HZ 100 >X@@ -235,6 +244,31 @@ >X } >X >X //get jiffies count from /proc filesystem >X+int getjiffies(int pid) >X+{ >X+ kvm_t *my_kernel = NULL; >X+ struct kinfo_proc *process_data = NULL; >X+ int processes; >X+ int my_jiffies = -1; >X+ >X+ my_kernel = kvm_open(0, 0, 0, O_RDONLY, "kvm_open"); >X+ if (! my_kernel) >X+ { >X+ printf("Error opening kernel vm. You should be running as root.\n"); >X+ return -1; >X+ } >X+ >X+ process_data = kvm_getprocs(my_kernel, KERN_PROC_PID, pid, &processes); >X+ if ( (process_data) && (processes >= 1) ) >X+ my_jiffies = process_data->ki_runtime; >X+ >X+ kvm_close(my_kernel); >X+ if (my_jiffies >= 0) >X+ my_jiffies /= 1000; >X+ return my_jiffies; >X+} >X+ >X+/* >X int getjiffies(int pid) { >X static char stat[20]; >X static char buffer[1024]; >X@@ -255,6 +289,8 @@ >X int ktime=atoi(p+1); >X return utime+ktime; >X } >X+*/ >X+ >X >X //process instant photo >X struct process_screenshot { >8968e897a9353cfafcbb2d493c1807bf >exit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 156064
: 114403