[ VM / Service ] Added 'operatingSystem' property to VM object

Allows for VM service clients to determine information about the system
the service is running on. Needed for some DevTools functionality.

Change-Id: I530984816e6cc1e4ca378454882219085e2d9de8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111361
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ben Konyi 2019-07-30 22:31:26 +00:00
parent de013a4b51
commit 8591778065
8 changed files with 40 additions and 19 deletions

View file

@ -1,5 +1,8 @@
# Changelog
## 1.0.1
- support service protocol version 3.24
## 1.0.0+1
- Updated description and homepage.

View file

@ -994,8 +994,9 @@ vms.VM assertVM(vms.VM obj) {
assertString(obj.type);
assertString(obj.name);
assertInt(obj.architectureBits);
assertString(obj.targetCPU);
assertString(obj.hostCPU);
assertString(obj.operatingSystem);
assertString(obj.targetCPU);
assertString(obj.version);
assertInt(obj.pid);
assertInt(obj.startTime);

View file

@ -17,7 +17,7 @@ import 'src/service_extension_registry.dart';
export 'src/service_extension_registry.dart' show ServiceExtensionRegistry;
const String vmServiceVersion = '3.23.0';
const String vmServiceVersion = '3.24.0';
/// @optional
const String optional = 'optional';
@ -5321,12 +5321,15 @@ class VM extends Response {
/// Word length on target architecture (e.g. 32, 64).
int architectureBits;
/// The CPU we are generating code for.
String targetCPU;
/// The CPU we are actually running on.
String hostCPU;
/// The operating system we are running on.
String operatingSystem;
/// The CPU we are generating code for.
String targetCPU;
/// The Dart VM version string.
String version;
@ -5346,8 +5349,9 @@ class VM extends Response {
VM._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
name = json['name'];
architectureBits = json['architectureBits'];
targetCPU = json['targetCPU'];
hostCPU = json['hostCPU'];
operatingSystem = json['operatingSystem'];
targetCPU = json['targetCPU'];
version = json['version'];
pid = json['pid'];
startTime = json['startTime'];
@ -5362,8 +5366,9 @@ class VM extends Response {
json.addAll({
'name': name,
'architectureBits': architectureBits,
'targetCPU': targetCPU,
'hostCPU': hostCPU,
'operatingSystem': operatingSystem,
'targetCPU': targetCPU,
'version': version,
'pid': pid,
'startTime': startTime,

View file

@ -2,7 +2,7 @@ name: vm_service
description: >-
A library to communicate with a service implementing the Dart VM
service protocol.
version: 1.0.0+1
version: 1.0.1
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/vm_service

View file

@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
// VMOptions=--vm-name=Walter
import 'dart:io';
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
@ -16,6 +18,7 @@ var tests = <VMTest>[
expect(result['architectureBits'], isPositive);
expect(result['targetCPU'], new isInstanceOf<String>());
expect(result['hostCPU'], new isInstanceOf<String>());
expect(result['operatingSystem'], Platform.operatingSystem);
expect(result['version'], new isInstanceOf<String>());
expect(result['pid'], new isInstanceOf<int>());
expect(result['startTime'], isPositive);

View file

@ -4584,8 +4584,9 @@ void Service::PrintJSONForVM(JSONStream* js, bool ref) {
return;
}
jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord));
jsobj.AddProperty("targetCPU", CPU::Id());
jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware());
jsobj.AddProperty("operatingSystem", OS::Name());
jsobj.AddProperty("targetCPU", CPU::Id());
jsobj.AddProperty("version", Version::String());
jsobj.AddProperty("_profilerMode", FLAG_profile_vm ? "VM" : "Dart");
jsobj.AddProperty64("_nativeZoneMemoryUsage",

View file

@ -1,8 +1,8 @@
# Dart VM Service Protocol 3.23
# Dart VM Service Protocol 3.24
> Please post feedback to the [observatory-discuss group][discuss-list]
This document describes of _version 3.23_ of the Dart VM Service Protocol. This
This document describes of _version 3.24_ of the Dart VM Service Protocol. This
protocol is used to communicate with a running Dart Virtual Machine.
To use the Service Protocol, start the VM with the *--observe* flag.
@ -3091,12 +3091,15 @@ class VM extends Response {
// Word length on target architecture (e.g. 32, 64).
int architectureBits;
// The CPU we are generating code for.
string targetCPU;
// The CPU we are actually running on.
string hostCPU;
// The operating system we are running on.
string operatingSystem;
// The CPU we are generating code for.
string targetCPU;
// The Dart VM version string.
string version;
@ -3143,5 +3146,6 @@ version | comments
3.21 | Add 'getVMTimelineMicros' RPC and 'Timestamp' object.
3.22 | Add `registerService` RPC, `Service` stream, and `ServiceRegistered` and `ServiceUnregistered` event kinds.
3.23 | Add `VMFlagUpdate` event kind to the `VM` stream.
3.24 | Add `operatingSystem` property to `VM` object.
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss

View file

@ -1,8 +1,8 @@
# Dart VM Service Protocol 3.24-dev
# Dart VM Service Protocol 3.25-dev
> Please post feedback to the [observatory-discuss group][discuss-list]
This document describes of _version 3.24-dev_ of the Dart VM Service Protocol. This
This document describes of _version 3.25-dev_ of the Dart VM Service Protocol. This
protocol is used to communicate with a running Dart Virtual Machine.
To use the Service Protocol, start the VM with the *--observe* flag.
@ -3091,12 +3091,15 @@ class VM extends Response {
// Word length on target architecture (e.g. 32, 64).
int architectureBits;
// The CPU we are generating code for.
string targetCPU;
// The CPU we are actually running on.
string hostCPU;
// The operating system we are running on.
string operatingSystem;
// The CPU we are generating code for.
string targetCPU;
// The Dart VM version string.
string version;
@ -3143,5 +3146,6 @@ version | comments
3.21 | Add 'getVMTimelineMicros' RPC and 'Timestamp' object.
3.22 | Add `registerService` RPC, `Service` stream, and `ServiceRegistered` and `ServiceUnregistered` event kinds.
3.23 | Add `VMFlagUpdate` event kind to the `VM` stream.
3.24 | Add `operatingSystem` property to `VM` object.
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss