diff options
author | Diego <diegolparra@gmail.com> | 2014-06-24 23:35:14 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-07-21 17:13:28 -0300 |
commit | 5c141733ad39cf2730cf34dc8f3f4a82f0c1b516 (patch) | |
tree | ab2830795cacae80aa232e41ed224534572ba678 /kamon-system/src/main/scala/kamon/system/native | |
parent | a96f6dadd5f77271672215e731b842ce785954f4 (diff) | |
download | Kamon-5c141733ad39cf2730cf34dc8f3f4a82f0c1b516.tar.gz Kamon-5c141733ad39cf2730cf34dc8f3f4a82f0c1b516.tar.bz2 Kamon-5c141733ad39cf2730cf34dc8f3f4a82f0c1b516.zip |
! kamon-system-metrics: introducing System and JVM metrics module
Diffstat (limited to 'kamon-system/src/main/scala/kamon/system/native')
23 files changed, 0 insertions, 104 deletions
diff --git a/kamon-system/src/main/scala/kamon/system/native/SigarLoader.scala b/kamon-system/src/main/scala/kamon/system/native/SigarLoader.scala deleted file mode 100644 index 511a8ffc..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/SigarLoader.scala +++ /dev/null @@ -1,82 +0,0 @@ -package kamon.system.native - -import org.hyperic.sigar.Sigar -import org.hyperic.sigar.SigarProxy -import java.io._ -import scalax.io.JavaConverters._ -import scalax.io._ - -import Resource._ - -import scalax.file.Path -import java.util -import scala.collection.JavaConversions._ - -object SigarLoader { - val Version = "1.6.4" - val JavaLibraryPath = "java.library.path" - val TmpDir = "java.io.tmpdir" - val IndexFile = "/kamon/system/native/index" - val UsrPathField = "usr_paths" - - def init: SigarProxy = init(new File(System.getProperty(TmpDir))) - - private def init(baseTmp: File): SigarProxy = { - val tmpDir = createTmpDir(baseTmp) - for (lib ← loadIndex) copy(lib, tmpDir) - - attachToLibraryPath(tmpDir) - - try { - val sigar = new Sigar - sigar.getPid - sigar - } catch { - case t: Throwable ⇒ - throw new RuntimeException("Failed to load sigar", t) - } - } - - private val usrPathField = { - val usrPathField = classOf[ClassLoader].getDeclaredField(UsrPathField) - usrPathField.setAccessible(true) - usrPathField - } - - private def attachToLibraryPath(dir: File): Unit = { - val dirAbsolute = dir.getAbsolutePath - System.setProperty(JavaLibraryPath, newLibraryPath(dirAbsolute)) - var paths = usrPathField.get(null).asInstanceOf[Array[String]] - if (paths == null) paths = new Array[String](0) - for (path ← paths) if (path == dirAbsolute) return - val newPaths = util.Arrays.copyOf(paths, paths.length + 1) - newPaths(newPaths.length - 1) = dirAbsolute - usrPathField.set(null, newPaths) - } - - private def newLibraryPath(dirAbsolutePath: String): String = { - Option(System.getProperty(JavaLibraryPath)).fold(dirAbsolutePath)(oldValue ⇒ s"$dirAbsolutePath${File.pathSeparator}$oldValue") - } - - private def copy(lib: String, tmpDir: File) { - val dest: Path = Path(new File(tmpDir, lib)) - if (dest.exists) return - val currentFile = Resource.fromInputStream(classOf[Loader].getResourceAsStream("" + lib)) - currentFile.acquireFor(current ⇒ dest.doCopyFrom(current.asInput)) - } - - private def createTmpDir(baseTmp: File): File = { - val path = Path(new File(baseTmp, s"sigar-$Version")) - path.createDirectory(failIfExists = false) - path.jfile - } - - private def loadIndex: util.List[String] = { - val libs = new util.ArrayList[String] - val input = fromInputStream(classOf[Loader].getResourceAsStream(IndexFile)) - input.lines().foreach(libs.add) - libs - } -} - -class Loader
\ No newline at end of file diff --git a/kamon-system/src/main/scala/kamon/system/native/index b/kamon-system/src/main/scala/kamon/system/native/index deleted file mode 100644 index ebc7f952..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/index +++ /dev/null @@ -1,22 +0,0 @@ -libsigar-amd64-freebsd-6.so -libsigar-amd64-linux.so -libsigar-amd64-solaris.so -libsigar-ia64-hpux-11.sl -libsigar-ia64-linux.so -libsigar-pa-hpux-11.sl -libsigar-ppc64-aix-5.so -libsigar-ppc64-linux.so -libsigar-ppc-aix-5.so -libsigar-ppc-linux.so -libsigar-s390x-linux.so -libsigar-sparc64-solaris.so -libsigar-sparc-solaris.so -libsigar-universal64-macosx.dylib -libsigar-universal-macosx.dylib -libsigar-x86-freebsd-5.so -libsigar-x86-freebsd-6.so -libsigar-x86-linux.so -libsigar-x86-solaris.so -sigar-amd64-winnt.dll -sigar-x86-winnt.dll - diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-freebsd-6.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-freebsd-6.so Binary files differdeleted file mode 100644 index 3e94f0d2..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-freebsd-6.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-linux.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-linux.so Binary files differdeleted file mode 100644 index 5a2e4c24..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-linux.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-solaris.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-solaris.so Binary files differdeleted file mode 100644 index 6396482a..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-amd64-solaris.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-ia64-hpux-11.sl b/kamon-system/src/main/scala/kamon/system/native/libsigar-ia64-hpux-11.sl Binary files differdeleted file mode 100644 index d92ea4a9..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-ia64-hpux-11.sl +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-ia64-linux.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-ia64-linux.so Binary files differdeleted file mode 100644 index 2bd2fc8e..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-ia64-linux.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-pa-hpux-11.sl b/kamon-system/src/main/scala/kamon/system/native/libsigar-pa-hpux-11.sl Binary files differdeleted file mode 100644 index 0dfd8a11..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-pa-hpux-11.sl +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc-aix-5.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc-aix-5.so Binary files differdeleted file mode 100644 index 7d4b5199..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc-aix-5.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc-linux.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc-linux.so Binary files differdeleted file mode 100644 index 4394b1b0..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc-linux.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc64-aix-5.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc64-aix-5.so Binary files differdeleted file mode 100644 index 35fd8288..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc64-aix-5.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc64-linux.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc64-linux.so Binary files differdeleted file mode 100644 index a1ba2529..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-ppc64-linux.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-s390x-linux.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-s390x-linux.so Binary files differdeleted file mode 100644 index c275f4ac..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-s390x-linux.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-sparc-solaris.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-sparc-solaris.so Binary files differdeleted file mode 100644 index aa847d2b..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-sparc-solaris.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-sparc64-solaris.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-sparc64-solaris.so Binary files differdeleted file mode 100644 index 6c4fe809..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-sparc64-solaris.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-universal-macosx.dylib b/kamon-system/src/main/scala/kamon/system/native/libsigar-universal-macosx.dylib Binary files differdeleted file mode 100644 index 27ab1071..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-universal-macosx.dylib +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-universal64-macosx.dylib b/kamon-system/src/main/scala/kamon/system/native/libsigar-universal64-macosx.dylib Binary files differdeleted file mode 100644 index 0c721fec..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-universal64-macosx.dylib +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-freebsd-5.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-freebsd-5.so Binary files differdeleted file mode 100644 index 8c50c611..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-freebsd-5.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-freebsd-6.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-freebsd-6.so Binary files differdeleted file mode 100644 index f0800274..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-freebsd-6.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-linux.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-linux.so Binary files differdeleted file mode 100644 index a0b64edd..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-linux.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-solaris.so b/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-solaris.so Binary files differdeleted file mode 100644 index c6452e56..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/libsigar-x86-solaris.so +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/sigar-amd64-winnt.dll b/kamon-system/src/main/scala/kamon/system/native/sigar-amd64-winnt.dll Binary files differdeleted file mode 100644 index 1ec8a035..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/sigar-amd64-winnt.dll +++ /dev/null diff --git a/kamon-system/src/main/scala/kamon/system/native/sigar-x86-winnt.dll b/kamon-system/src/main/scala/kamon/system/native/sigar-x86-winnt.dll Binary files differdeleted file mode 100644 index 6afdc016..00000000 --- a/kamon-system/src/main/scala/kamon/system/native/sigar-x86-winnt.dll +++ /dev/null |