Author: atsushi
Date: 2006-04-03 20:36:49 -0400 (Mon, 03 Apr 2006)
New Revision: 58989
Added:
trunk/mcs/class/System/System.Diagnostics/DataReceivedEventArgs.cs
trunk/mcs/class/System/System.Diagnostics/DataReceivedEventHandler.cs
trunk/mcs/class/System/Test/System.Diagnostics/StopwatchTest.cs
Modified:
trunk/mcs/class/System/ChangeLog
trunk/mcs/class/System/System.Diagnostics/ChangeLog
trunk/mcs/class/System/System.Diagnostics/Process.cs
trunk/mcs/class/System/System.Diagnostics/Stopwatch.cs
trunk/mcs/class/System/System.dll.sources
trunk/mcs/class/System/System_test.dll.sources
trunk/mcs/class/System/Test/System.Diagnostics/ChangeLog
Log:
2006-04-04 Atsushi Enomoto <[EMAIL PROTECTED]>
* System.dll.sources: added DataReceivedEventArgs.cs and
DataReceivedEventHandler.cs.
* System_test.dll.sources : added StopwatchTest.cs.
* Stopwatch.cs:
Zoltan was quicker to add it, here I put my implementation ;-)
* Process.cs :
Added some missing long members (not implemented anyways).
* DataReceivedEventHandler.cs DataReceivedEventArgs.cs :
added new 2.0 types.
* StopwatchTest.cs : new test.
Modified: trunk/mcs/class/System/ChangeLog
===================================================================
--- trunk/mcs/class/System/ChangeLog 2006-04-04 00:27:46 UTC (rev 58988)
+++ trunk/mcs/class/System/ChangeLog 2006-04-04 00:36:49 UTC (rev 58989)
@@ -1,3 +1,9 @@
+2006-04-04 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * System.dll.sources: added DataReceivedEventArgs.cs and
+ DataReceivedEventHandler.cs.
+ * System_test.dll.sources : added StopwatchTest.cs.
+
2006-04-01 Zoltan Varga <[EMAIL PROTECTED]>
* System.dll.sources: Added System.Diagnostics/Stopwatch.cs.
Modified: trunk/mcs/class/System/System.Diagnostics/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/ChangeLog 2006-04-04 00:27:46 UTC
(rev 58988)
+++ trunk/mcs/class/System/System.Diagnostics/ChangeLog 2006-04-04 00:36:49 UTC
(rev 58989)
@@ -1,3 +1,12 @@
+2006-04-04 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * Stopwatch.cs:
+ Zoltan was quicker to add it, here I put my implementation ;-)
+ * Process.cs :
+ Added some missing long members (not implemented anyways).
+ * DataReceivedEventHandler.cs DataReceivedEventArgs.cs :
+ added new 2.0 types.
+
2006-04-01 Zoltan Varga <[EMAIL PROTECTED]>
* Stopwatch.cs: New file.
Added: trunk/mcs/class/System/System.Diagnostics/DataReceivedEventArgs.cs
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/DataReceivedEventArgs.cs
2006-04-04 00:27:46 UTC (rev 58988)
+++ trunk/mcs/class/System/System.Diagnostics/DataReceivedEventArgs.cs
2006-04-04 00:36:49 UTC (rev 58989)
@@ -0,0 +1,48 @@
+//
+// DataReceivedEventArgs.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Diagnostics
+{
+ public class DataReceivedEventArgs : EventArgs
+ {
+ string data;
+
+ internal DataReceivedEventArgs (string data)
+ {
+ this.data = data;
+ }
+
+ public string Data {
+ get { return data; }
+ }
+ }
+}
+
+#endif
Property changes on:
trunk/mcs/class/System/System.Diagnostics/DataReceivedEventArgs.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/mcs/class/System/System.Diagnostics/DataReceivedEventHandler.cs
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/DataReceivedEventHandler.cs
2006-04-04 00:27:46 UTC (rev 58988)
+++ trunk/mcs/class/System/System.Diagnostics/DataReceivedEventHandler.cs
2006-04-04 00:36:49 UTC (rev 58989)
@@ -0,0 +1,37 @@
+//
+// DataReceivedEventHandler.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+namespace System.Diagnostics
+{
+ public delegate void DataReceivedEventHandler (
+ object sender, DataReceivedEventArgs e);
+}
+
+#endif
Property changes on:
trunk/mcs/class/System/System.Diagnostics/DataReceivedEventHandler.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/mcs/class/System/System.Diagnostics/Process.cs
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/Process.cs 2006-04-04
00:27:46 UTC (rev 58988)
+++ trunk/mcs/class/System/System.Diagnostics/Process.cs 2006-04-04
00:36:49 UTC (rev 58989)
@@ -321,6 +321,9 @@
}
[MonoTODO]
+#if NET_2_0
+ [Obsolete ("Use NonpagedSystemMemorySize64")]
+#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The number of bytes that are not
pageable.")]
public int NonpagedSystemMemorySize {
@@ -330,6 +333,9 @@
}
[MonoTODO]
+#if NET_2_0
+ [Obsolete ("Use PagedMemorySize64")]
+#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The number of bytes that are paged.")]
public int PagedMemorySize {
@@ -339,6 +345,9 @@
}
[MonoTODO]
+#if NET_2_0
+ [Obsolete ("Use PagedSystemMemorySize64")]
+#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The amount of paged system memory in
bytes.")]
public int PagedSystemMemorySize {
@@ -348,6 +357,9 @@
}
[MonoTODO]
+#if NET_2_0
+ [Obsolete ("Use PeakPagedMemorySize64")]
+#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The maximum amount of paged memory
used by this process.")]
public int PeakPagedMemorySize {
@@ -357,6 +369,9 @@
}
[MonoTODO]
+#if NET_2_0
+ [Obsolete ("Use PeakVirtualMemorySize64")]
+#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The maximum amount of virtual memory
used by this process.")]
public int PeakVirtualMemorySize {
@@ -366,6 +381,9 @@
}
[MonoTODO]
+#if NET_2_0
+ [Obsolete ("Use PeakWorkingSet64")]
+#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The maximum amount of system memory
used by this process.")]
public int PeakWorkingSet {
@@ -374,8 +392,64 @@
}
}
+#if NET_2_0
[MonoTODO]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [MonitoringDescription ("The number of bytes that are not
pageable.")]
+ public long NonpagedSystemMemorySize64 {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [MonitoringDescription ("The number of bytes that are paged.")]
+ public long PagedMemorySize64 {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [MonitoringDescription ("The amount of paged system memory in
bytes.")]
+ public long PagedSystemMemorySize64 {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [MonitoringDescription ("The maximum amount of paged memory
used by this process.")]
+ public long PeakPagedMemorySize64 {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [MonitoringDescription ("The maximum amount of virtual memory
used by this process.")]
+ public long PeakVirtualMemorySize64 {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [MonitoringDescription ("The maximum amount of system memory
used by this process.")]
+ public long PeakWorkingSet64 {
+ get {
+ return(0);
+ }
+ }
+#endif
+
+ [MonoTODO]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("Process will be of higher priority
while it is actively used.")]
public bool PriorityBoostEnabled {
get {
@@ -582,6 +656,9 @@
}
[MonoTODO]
+#if NET_2_0
+ [Obsolete ("Use VirtualMemorySize64")]
+#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The amount of virtual memory currently
used for this process.")]
public int VirtualMemorySize {
@@ -591,6 +668,9 @@
}
[MonoTODO]
+#if NET_2_0
+ [Obsolete ("Use WorkingSet64")]
+#endif
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The amount of physical memory
currently used for this process.")]
public int WorkingSet {
@@ -599,6 +679,26 @@
}
}
+#if NET_2_0
+ [MonoTODO]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [MonitoringDescription ("The amount of virtual memory currently
used for this process.")]
+ public long VirtualMemorySize64 {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ [MonitoringDescription ("The amount of physical memory
currently used for this process.")]
+ public long WorkingSet64 {
+ get {
+ return(0);
+ }
+ }
+#endif
+
public void Close()
{
Dispose (true);
Modified: trunk/mcs/class/System/System.Diagnostics/Stopwatch.cs
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/Stopwatch.cs 2006-04-04
00:27:46 UTC (rev 58988)
+++ trunk/mcs/class/System/System.Diagnostics/Stopwatch.cs 2006-04-04
00:36:49 UTC (rev 58989)
@@ -3,9 +3,9 @@
//
// Authors:
// Zoltan Varga ([EMAIL PROTECTED])
+// Atsushi Enomoto <[EMAIL PROTECTED]>
//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-// Copyright (C) 2004-2005 Novell (http://www.novell.com)
+// (C) 2006 Novell, Inc.
//
//
@@ -32,73 +32,84 @@
#if NET_2_0
using System;
+using System.ComponentModel;
-namespace System.Diagnostics {
-
- public class Stopwatch {
-
+namespace System.Diagnostics
+{
+ public class Stopwatch
+ {
+ [MonoTODO ("high resolution mode support")]
public static readonly long Frequency;
+ [MonoTODO ("high resolution mode support")]
public static readonly bool IsHighResolution;
- [MonoTODO]
- public Stopwatch () {
- throw new NotImplementedException ();
+ [MonoTODO ("high resolution mode support")]
+ public static long GetTimestamp ()
+ {
+ return DateTime.Now.Ticks;
}
- [MonoTODO]
+ public static Stopwatch StartNew ()
+ {
+ Stopwatch s = new Stopwatch ();
+ s.Start ();
+ return s;
+ }
+
+ static Stopwatch ()
+ {
+ Frequency = TimeSpan.TicksPerSecond;
+ IsHighResolution = false;
+ }
+
+ public Stopwatch ()
+ {
+ }
+
+ long elapsed;
+ long started;
+ bool is_running;
+
+ [MonoTODO ("high resolution mode support")]
public TimeSpan Elapsed {
- get {
- throw new NotImplementedException ();
- }
+ get { return TimeSpan.FromTicks (ElapsedTicks); }
}
- [MonoTODO]
+ [MonoTODO ("high resolution mode support")]
public long ElapsedMilliseconds {
- get {
- throw new NotImplementedException ();
- }
+ get { checked { return (long)
Elapsed.TotalMilliseconds; } }
}
- [MonoTODO]
public long ElapsedTicks {
- get {
- throw new NotImplementedException ();
- }
+ get { return is_running ? GetTimestamp () - started +
elapsed : elapsed; }
}
- [MonoTODO]
public bool IsRunning {
- get {
- throw new NotImplementedException ();
- }
+ get { return is_running; }
}
- [MonoTODO]
- public static long GetTimestamp () {
- throw new NotImplementedException ();
+ public void Reset ()
+ {
+ elapsed = 0;
+ is_running = false;
}
- [MonoTODO]
- public void Reset () {
- throw new NotImplementedException ();
+ public void Start ()
+ {
+ if (is_running)
+ return;
+ started = GetTimestamp ();
+ is_running = true;
}
- [MonoTODO]
- public void Start () {
- throw new NotImplementedException ();
+ public void Stop ()
+ {
+ if (!is_running)
+ return;
+ elapsed += GetTimestamp () - started;
+ is_running = false;
}
-
- [MonoTODO]
- public void Stop () {
- throw new NotImplementedException ();
- }
-
- public static Stopwatch StartNew () {
- Stopwatch s = new Stopwatch ();
- s.Start ();
- return s;
- }
}
}
Modified: trunk/mcs/class/System/System.dll.sources
===================================================================
--- trunk/mcs/class/System/System.dll.sources 2006-04-04 00:27:46 UTC (rev
58988)
+++ trunk/mcs/class/System/System.dll.sources 2006-04-04 00:36:49 UTC (rev
58989)
@@ -403,6 +403,8 @@
System.Diagnostics/CounterCreationData.cs
System.Diagnostics/CounterSampleCalculator.cs
System.Diagnostics/CounterSample.cs
+System.Diagnostics/DataReceivedEventArgs.cs
+System.Diagnostics/DataReceivedEventHandler.cs
System.Diagnostics/Debug.cs
System.Diagnostics/DefaultTraceListener.cs
System.Diagnostics/DiagnosticsConfigurationHandler.cs
Modified: trunk/mcs/class/System/System_test.dll.sources
===================================================================
--- trunk/mcs/class/System/System_test.dll.sources 2006-04-04 00:27:46 UTC
(rev 58988)
+++ trunk/mcs/class/System/System_test.dll.sources 2006-04-04 00:36:49 UTC
(rev 58989)
@@ -124,6 +124,7 @@
System.ComponentModel/UInt64ConverterTests.cs
System.ComponentModel.Design/ServiceContainerTest.cs
System.ComponentModel.Design.Serialization/InstanceDescriptorTest.cs
+System.Diagnostics/StopwatchTest.cs
System.Diagnostics/TraceTest.cs
System.Diagnostics/SwitchesTest.cs
System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs
Modified: trunk/mcs/class/System/Test/System.Diagnostics/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.Diagnostics/ChangeLog 2006-04-04
00:27:46 UTC (rev 58988)
+++ trunk/mcs/class/System/Test/System.Diagnostics/ChangeLog 2006-04-04
00:36:49 UTC (rev 58989)
@@ -1,3 +1,7 @@
+2006-04-04 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * StopwatchTest.cs : new test.
+
2005-09-22 Sebastien Pouliot <[EMAIL PROTECTED]>
* EventLogPermissionAttributeTest.cs: Removed *Choice security actions
Added: trunk/mcs/class/System/Test/System.Diagnostics/StopwatchTest.cs
===================================================================
--- trunk/mcs/class/System/Test/System.Diagnostics/StopwatchTest.cs
2006-04-04 00:27:46 UTC (rev 58988)
+++ trunk/mcs/class/System/Test/System.Diagnostics/StopwatchTest.cs
2006-04-04 00:36:49 UTC (rev 58989)
@@ -0,0 +1,50 @@
+//
+// StopwatchTest.cs
+//
+// Author:
+// Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2006 Novell, Inc.
+//
+#if NET_2_0
+using System;
+using System.Diagnostics;
+using System.Threading;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics
+{
+ [TestFixture]
+ public class StopwatchTest
+ {
+ [Test]
+ public void TestSimple ()
+ {
+ // It starts at started state.
+ Stopwatch sw = Stopwatch.StartNew ();
+ Thread.Sleep (1000);
+ sw.Stop ();
+ long ticks = sw.ElapsedTicks;
+ Assert.IsTrue (sw.ElapsedMilliseconds > 100, "#1");
+ Thread.Sleep (1000);
+ // do not increment resuts
+ Assert.AreEqual (ticks, sw.ElapsedTicks, "#2");
+ sw.Start ();
+ Thread.Sleep (1000);
+ // increment results
+ Assert.IsTrue (sw.ElapsedTicks > ticks, "#3");
+ ticks = sw.ElapsedTicks;
+ sw.Stop ();
+ Assert.IsTrue (sw.ElapsedTicks >= ticks, "#4");
+ sw.Reset ();
+ Assert.AreEqual (0, sw.ElapsedTicks, "#5");
+ sw.Start ();
+ Thread.Sleep (1000);
+ Assert.IsTrue (sw.ElapsedTicks > 100, "#5");
+ // This test is not strict but would mostly work.
+ Assert.IsTrue (ticks > sw.ElapsedTicks, "#6");
+ sw.Stop ();
+ }
+ }
+}
+#endif
Property changes on:
trunk/mcs/class/System/Test/System.Diagnostics/StopwatchTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches