Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
LINUX系統程式設計 第二版
by
Robert Love
December 2013
Intermediate to advanced
496 pages
8h 57m
Chinese
GoTop Information, Inc.
Content preview from
LINUX系統程式設計 第二版
400
|
第十一章
執行成功時,此呼叫會把進行調用之行程與它的子行程所耗用的行程時間填入
buf
所指
向的
tms
結構。所回報的時間會被分解成用戶和系統時間。
用戶時間
(
user time
)就是
在用戶空間中執行程式碼所花的時間。
系統時間
(
system time
)就是在核心空間中執行
程式碼所花的時間—例如,系統呼叫期間或頁面失誤。只有在子行程終止以及父行程對
行程調用
waitpid()
(或一個相關的函式)之後才會回報子行程的時間。此呼叫會傳回自
從過去某一參考點之後單調遞增的時鐘週期數目。這個參考點曾經是系統啟動時間—因
此,
times()
函式會傳回
system uptime
(以時鐘週期計)—但是現在這個參考點大約是
系統啟動之前
429
百萬秒。核心開發者會實作此變更,是為了避免核心程式碼無法處理
system uptime
繞回變為零的情況。此函式所傳回的是絕對值(而非相對值)因而毫無用
處;然而,兩次調用之間的相對變化仍是有價值的。
執行失敗時,此呼叫會傳回
-1
,而且會把
errno
設定為適當的值。
Linux
之上,只有一
個可能的錯誤碼,
EFAULT
,代表
buf
是一個無效的指標。
設定當前時間
前面所描述的是如何取得時間,然而應用程式偶爾也需要把當前的時間與日期設定為所
指定的值。這幾乎總是可以使用專為此用途而設計的共用程式,例如
date
,來處理。
time()
的時間設定版本為
stime()
:
#define _SVID_SOURCE
#include <time.h>
int stime (time_t *t); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
優雅的SciPy|Python科學研究的美學
Juan Nunez-Iglesias, Stéfan van der Walt, Harriet Dashnow
成為卓越程式設計師的38項必修法則
Pete Goodliffe
深入理解運算原理|從簡單的機器到無所不能的程式
Tom Stuart
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
Publisher Resources
ISBN: 9789862769812