Index: runtime/bin/vmstats.h |
=================================================================== |
--- runtime/bin/vmstats.h (revision 0) |
+++ runtime/bin/vmstats.h (revision 0) |
@@ -0,0 +1,51 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
siva
2013/02/09 01:00:57
2013
Tom Ball
2013/02/14 23:45:16
Done.
|
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#ifndef BIN_VMSTATS_H_ |
+#define BIN_VMSTATS_H_ |
+ |
+#include <map> |
+#include <sstream> |
+#include <string> |
+ |
+#include "bin/isolate_data.h" |
+#include "include/dart_debugger_api.h" |
+ |
+namespace dart { |
+ |
+// VmStats is a HTTP singleton service that reports status information |
+// of the running VM. |
+ |
+class VmStats { |
+ public: |
+ static void Start(int port); |
+ static void Stop(); |
+ |
+ // Add and remove functions for the isolate_table, called by main.cc. |
+ static void AddIsolate(IsolateData* isolate_data, Dart_Isolate isolate); |
+ static void RemoveIsolate(IsolateData* isolate_data); |
+ |
+ private: |
+ VmStats() {} |
+ |
+ // Initial server thread function. |
+ static void WebServer(uword server_socket); |
+ |
+ // Status text generators. |
+ void MemoryUsed(std::ostringstream* stream); |
+ |
+ typedef std::map<IsolateData*, Dart_Isolate> IsolateTable; |
+ |
+ std::string root_directory_; |
+ IsolateTable isolate_table_; |
+ |
+ static VmStats* instance_; |
+ |
+ // Disallow copy constructor. |
+ DISALLOW_COPY_AND_ASSIGN(VmStats); |
+}; |
+ |
+} // namespace dart |
+ |
+#endif // BIN_VMSTATS_H_ |