diff --git a/lib/Drupal/xhprof/XHProfBundle.php b/lib/Drupal/xhprof/XHProfBundle.php
new file mode 100644
index 0000000..c20975a
--- /dev/null
+++ b/lib/Drupal/xhprof/XHProfBundle.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\xhprof\XHProfBundle.
+ */
+
+namespace Drupal\xhprof;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+/**
+ * The bundle for xhprof.module.
+ */
+class XHProfBundle extends Bundle
+{
+  public function build(ContainerBuilder $container) {
+    $container->register('xhprof.xhprof_subscriber', 'Drupal\xhprof\XHProfSubscriber')
+      ->addTag('event_subscriber');
+  }
+}
\ No newline at end of file
diff --git a/lib/Drupal/xhprof/XHProfSubscriber.php b/lib/Drupal/xhprof/XHProfSubscriber.php
new file mode 100644
index 0000000..4c2ccbe
--- /dev/null
+++ b/lib/Drupal/xhprof/XHProfSubscriber.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * @file
+ * Definition of Drupal\xhprof\XHProfSubscriber.
+ */
+
+namespace Drupal\xhprof;
+
+use Symfony\Component\HttpKernel\KernelEvents;
+use Drupal\Core\Config\StorageDispatcher;
+use Symfony\Component\HttpKernel\Event;
+use Symfony\Component\HttpKernel\Event\GetResponseEvent;
+use Drupal\Core\Language\LanguageManager;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+
+/**
+ * Implements XHProfSubscriber
+ */
+class XHProfSubscriber implements EventSubscriberInterface {
+
+  /**
+   * @param Symfony\Component\HttpKernel\Event\GetResponseEvent $event
+   *   The Event to process.
+   */
+  public function XHProfLoad(GetResponseEvent $event) {
+    // Initialize XHProf.
+    if (xhprof_xhprof_enable()) {
+      drupal_register_shutdown_function('xhprof_shutdown');
+    }
+  }
+
+  /**
+   * Implements EventSubscriberInterface::getSubscribedEvents().
+   */
+  static function getSubscribedEvents() {
+    $events[KernelEvents::REQUEST][] = array('XHProfLoad', 999);
+    return $events;
+  }
+}
diff --git a/xhprof.info b/xhprof.info
deleted file mode 100644
index b0a1d7c..0000000
--- a/xhprof.info
+++ /dev/null
@@ -1,6 +0,0 @@
-name = xhprof
-description = Provides code profiling with XHProf integration.
-package = Development
-core = 8.x
-
-configure = admin/config/development/xhprof
diff --git a/xhprof.info.yml b/xhprof.info.yml
new file mode 100644
index 0000000..1f83ba9
--- /dev/null
+++ b/xhprof.info.yml
@@ -0,0 +1,6 @@
+name: xhprof
+description: Provides code profiling with XHProf integration.
+package: Development
+core: 8.x
+
+configure: admin/config/development/xhprof
diff --git a/xhprof.module b/xhprof.module
index 5f121f2..192412c 100644
--- a/xhprof.module
+++ b/xhprof.module
@@ -118,16 +118,6 @@ function xhprof_is_enabled() {
 }
 
 /**
- * Implementation of hook_boot(). Runs even for cached pages.
- */
-function xhprof_boot() {
-  // Initialize XHProf.
-  if (xhprof_xhprof_enable()) {
-    drupal_register_shutdown_function('xhprof_shutdown');
-  }
-}
-
-/**
  * See xhprof_start() which registers this function as a shutdown function.
  */
 function xhprof_shutdown() {
