lib/skylight/native.rb in skylight-1.7.2 vs lib/skylight/native.rb in skylight-2.0.0.beta1
- old
+ new
@@ -1,6 +1,6 @@
-require 'skylight/util/platform'
+require 'skylight/core/util/platform'
module Skylight
# @api private
# Whether or not the native extension is present
@@has_native_ext = false
@@ -8,18 +8,18 @@
def self.native?
@@has_native_ext
end
def self.libskylight_path
- ENV['SKYLIGHT_LIB_PATH'] || File.expand_path("../native/#{Util::Platform.tuple}", __FILE__)
+ ENV['SKYLIGHT_LIB_PATH'] || File.expand_path("../native/#{Core::Util::Platform.tuple}", __FILE__)
end
skylight_required = ENV.key?("SKYLIGHT_REQUIRED") && ENV['SKYLIGHT_REQUIRED'] !~ /^false$/i
begin
unless ENV.key?("SKYLIGHT_DISABLE_AGENT") && ENV['SKYLIGHT_DISABLE_AGENT'] !~ /^false$/i
- lib = "#{libskylight_path}/libskylight.#{Util::Platform.libext}"
+ lib = "#{libskylight_path}/libskylight.#{Core::Util::Platform.libext}"
if File.exist?(lib)
# First attempt to require the native extension
require "skylight_native"
@@ -37,11 +37,13 @@
raise if skylight_required || e.message !~ /dlerror/
rescue LoadError => e
raise if skylight_required
end
- unless Skylight.native?
+ if Skylight.native?
+ Skylight::Core::Util::Clock.use_native!
+ else
class Instrumenter
def self.native_new(*args)
allocate
end
end
@@ -52,19 +54,19 @@
# Note: An unsupported arch doesn't count as an error.
install_log = File.expand_path("../../../ext/install.log", __FILE__)
if File.exist?(install_log) && File.read(install_log) =~ /ERROR/
config.alert_logger.error \
- "[SKYLIGHT] [#{Skylight::VERSION}] The Skylight native extension failed to install. " \
+ "[SKYLIGHT] [#{Skylight::Core::VERSION}] The Skylight native extension failed to install. " \
"Please check #{install_log} and notify support@skylight.io. " \
"The missing extension will not affect the functioning of your application."
end
end
# @api private
def self.warn_skylight_native_missing(config)
config.alert_logger.error \
- "[SKYLIGHT] [#{Skylight::VERSION}] The Skylight native extension for " \
+ "[SKYLIGHT] [#{Skylight::Core::VERSION}] The Skylight native extension for " \
"your platform wasn't found. Supported operating systems are " \
"Linux 2.6.18+ and Mac OS X 10.8+. The missing extension will not " \
"affect the functioning of your application. If you are on a " \
"supported platform, please contact support at support@skylight.io."
end