linux 进程线程时间片
首先申明,我是菜鸟.菜到什么程度,大家看看下面的代码.
代码要求:取得1000次单独创建进程的时间.
[code:1:fdac913669]#include
#include
#include
#include
#include
strut timeval {
long tv_sec; /* 秒数 */
long tv_usec; /* 微秒数 */
};
int gettimeofday(struct timeval *tv,struct timezone *tz);
main()
{
struct timeval tpstart,tpend;
float timeuse;
unsigned int i;
gettimeofday(&tpstart,NULL);
for(i=0;i<1000;i++)
pid_t fork();
gettimeofday(&tpend,NULL);
timeuse=1000000*(tpend.tv_sec-tpstart.tv_sec)+tpend.tv_usec-tpstart.tv_usec;
timeuse/=1000000;
printf("Used Time:%f\n",timeuse);
exit(0);
}
[/code:1:fdac913669]
取得线程时间:
//线程
不知道该怎么做.因为int pthread_create(pthread_t * thread, pthread_attr_t * attr,
void * (*start_routine)(void *), void * arg)
需要返回一个参数,比如:
int ret;
ret=pthread_create(pthread_t * thread, NULL, void * (*start_routine)(void *), void * arg);
那么时间当中就包含了赋值的时间了.
[b:fdac913669]不知道大家对线程和进程的创建的时间取得有什么好的建议呢?[/b:fdac913669]
aero 回复于:2003-08-10 21:01:44
偶觉得,已经不菜了。
如果你菜,那偶就还是鸟蛋了。
coolhome 回复于:2003-08-10 20:27:00
[code:1:334e6e5b17]
include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
struct timeval {
long tv_sec; /* 秒数 */
long tv_usec; /* 微秒数 */
};
int gettimeofday(struct timeval *tv,struct timezone *tz);
main()
{
struct timeval tpstart,tpend;
float timeuse;
unsigned int i;
int rc;
int p1 = 0;
gettimeofday(&tpstart,NULL);
for(i=0;i&
相关文档:
默认:
httpd.conf 在/etc/httpd/conf
my.cnf 在/etc
php.ini 在/usr/local/lib
在Unix 上,php.ini文件缺省放在/usr/local/lib上面,因为缺省的存放路径是<install-path>
/lib,但是可以在编译的时候使用--with-config-file-path参数来修改php.ini的存放位置,例如你可以使用--with-
config-file-path ......
如果想让所有用户share:
emacs -nw /etc/profile
然后在未尾加入
#set java environment
set JAVA_HOME=/usr/java/jdk1.5.0_16
set PATH=.:$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME
如果仅当前用户使用:
把上面的加入用户目录下的.bash_profile或.bash-rc
然后运行source /etc/profile生效 ......
refer:http://blog.csdn.net/shangguanwaner/archive/2009/08/19/4463875.aspx
一个项目的服务器端在Linux平台下,用到了开源日志库log4cxx,这个库是apache项目的一个子库。功能很不错。下面记录下它的编译和安装过程。
log4cxx的官方下载地址是http://logging.apache.org/log4cxx/index.html
,我用的是0.10.0版 ......
1. 系统配置过程
2.1. oracle安装条件检查
2.1.1. 硬件检查
检查硬件情况是否符合oracle 10g 的安装要求。以root登录系统,用下表命令输出的值应大于或等于建议值。
检查项目
命令 ......
转自本人个人网站【PHP探路者 http://www.phpwell.com
】
原文地址 http://www.phpwell.com/?p=43
公司内的一台测试服务器原本只是放在公司内网上使用,现需要将测试环境置于Internet上,
以便于客户即时了解项目进展情况。为Linux系统增添一块网卡的过程记录如下:
步骤一:将一块新 ......