GithubHelp home page GithubHelp logo

sigar-native's Introduction

Sigar(全称System Information Gatherer And Reporter,即系统信息收集报表器),它提供了一个开源的跨平台的收集计算机硬件和操作系统信息的API(该API底层接口用C语言编写).

Kamon Sigar Loader

Provides convenient self-contained Sigar classes with native library deployment and provisioning mechanism with JDK-only dependencies for the following common use cases:

  • Java Agent: automatic extract/load at JVM start time
  • Programmatically: embedded library extraction
  • Framework Contract: OSGI bundle activation

To load as JVM java agent:

#
# Extract to default location: ${user.dir}/native
java -javaagent:/path/to/sigar-loader.jar ...

#
# Extract to provided library extract location.
java -javaagent:/path/to/sigar-loader.jar=kamon.sigar.folder=/path/to/library/extract/folder ...

Sigar loader agent can also be provided via JVM attach API

To load programmatically from your code:

// Required imports.
		import java.io.File;
		import org.hyperic.sigar.Sigar;
		import kamon.sigar.SigarProvisioner;

// Extract to default location: ${user.dir}/native 
		SigarProvisioner.provision();
		final Sigar sigar = new Sigar();

// Extract to user provided library extract location.
		final File location = new File("target/native");
		SigarProvisioner.provision(location);
		final Sigar sigar = new Sigar();

To load during OSGI bundle activation:

karaf@root()> bundle:install mvn:io.kamon/sigar-loader/1.6.5-rev001

Default extract location

Default library extract location used by

  • java -javaagent:/path/to/sigar-loader.jar and
  • SigarProvisioner.provision()

will be selected in the following priority order:

  1. environment variable KAMON_SIGAR_FOLDER
  2. system property kamon.sigar.folder
  3. hard coded ${user.dir}/native

Extract location in OSGI

Bundle activator will use framework persistent bundle storage location.

Repeated provision attempts

Sigar loader ensures that native library is loaded exactly once.

sigar-native's People

Watchers

James Cloos avatar majun avatar wandl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.