kruntime

package
v1.0.4-Realize Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

* 包kruntime包含了对程序运行时的相关封装及描述

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NumCPU

func NumCPU() int

返回当前进程可用的逻辑cpu数量

通过查询操作系统来检查可用的cpu集,调用了go lib中runtime.NumCPU函数。

func PathRunDir

func PathRunDir() string

返回当前程序运行目录的绝对路径

默认kercylan-lib库的kruntime包在被调用之处便通过初始化获取了当前应用程序运行的根目录绝对路径。

由于os.Args[0]获取的是应用程序的运行路径,那么通过filepath.Dir获取到应用程序的运行目录后通过filepath.Abs将其转换确保其为一个绝对路径。

func PathRunExe

func PathRunExe() string

返回当前运行的应用程序的绝对路径

os.Args[0]得到的值直接表示了应用程序的运行路径,并且这是一个绝对路径,等同于os.Args[0]。

func PathWork

func PathWork() string

返回当前运行的应用程序的工作路径

等同于os.Getwd。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL