Hello,
I am trying to measure the elapsed time between 2
processes. If I declare startTime As Double, endTime as
Double and say
startTime = Timer
....
process1
....
process2
....
endTime = Timer
this works fine. But if I use Imports System.Threadin g,
the program won't compile with ...=Timer. I want to
measure the elapsed time when I run the 2 processes on
different threads. Could someone explain the correct
syntax or way to accomplish this? I have tried
startTime = System.Timers.T imer
but not working. Should I use a dateTime var and then do
like a dateDiff thing?
TIA,
Rich 4 1122
dim start as long = DateTime.Now
'do something
dim end as long = DateTime.Now
dim t as TimeSpan = new TimeSpan(end - start)
't holds your info
"Rich" <an*******@disc ussions.microso ft.com> wrote in message
news:1e******** *************** ******@phx.gbl. .. Hello,
I am trying to measure the elapsed time between 2 processes. If I declare startTime As Double, endTime as Double and say
startTime = Timer ... process1 ... process2 ... endTime = Timer
this works fine. But if I use Imports System.Threadin g, the program won't compile with ...=Timer. I want to measure the elapsed time when I run the 2 processes on different threads. Could someone explain the correct syntax or way to accomplish this? I have tried
startTime = System.Timers.T imer
but not working. Should I use a dateTime var and then do like a dateDiff thing?
TIA, Rich
sorry DateTime.Now.Ti cks
"Greg Young" <gr********@pla netbeach.com> wrote in message
news:Oe******** ******@TK2MSFTN GP10.phx.gbl... dim start as long = DateTime.Now 'do something dim end as long = DateTime.Now
dim t as TimeSpan = new TimeSpan(end - start) 't holds your info
"Rich" <an*******@disc ussions.microso ft.com> wrote in message news:1e******** *************** ******@phx.gbl. .. Hello,
I am trying to measure the elapsed time between 2 processes. If I declare startTime As Double, endTime as Double and say
startTime = Timer ... process1 ... process2 ... endTime = Timer
this works fine. But if I use Imports System.Threadin g, the program won't compile with ...=Timer. I want to measure the elapsed time when I run the 2 processes on different threads. Could someone explain the correct syntax or way to accomplish this? I have tried
startTime = System.Timers.T imer
but not working. Should I use a dateTime var and then do like a dateDiff thing?
TIA, Rich
I would use timespan for this, not a timer, You should find it to be more
fitting.
"Rich" <an*******@disc ussions.microso ft.com> wrote in message
news:1e******** *************** ******@phx.gbl. .. Hello,
I am trying to measure the elapsed time between 2 processes. If I declare startTime As Double, endTime as Double and say
startTime = Timer ... process1 ... process2 ... endTime = Timer
this works fine. But if I use Imports System.Threadin g, the program won't compile with ...=Timer. I want to measure the elapsed time when I run the 2 processes on different threads. Could someone explain the correct syntax or way to accomplish this? I have tried
startTime = System.Timers.T imer
but not working. Should I use a dateTime var and then do like a dateDiff thing?
TIA, Rich
Thanks all. I have been working with .Net for only a few
months right now, so I have lots to learn. I will use the
TimeSpan thing as suggested.
Thanks for all the help.
Rich -----Original Message----- Hello,
I am trying to measure the elapsed time between 2 processes. If I declare startTime As Double, endTime as Double and say
startTime = Timer .... process1 .... process2 .... endTime = Timer
this works fine. But if I use Imports System.Threadin g, the program won't compile with ...=Timer. I want to measure the elapsed time when I run the 2 processes on different threads. Could someone explain the correct syntax or way to accomplish this? I have tried
startTime = System.Timers.T imer
but not working. Should I use a dateTime var and then do like a dateDiff thing?
TIA, Rich . This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jrlen balane |
last post by:
basically what the code does is transmit data to a hardware and then
receive data that the hardware will transmit.
import serial
import string
import time
from struct import *
ser = serial.Serial()
|
by: ray |
last post by:
Hi,
I just wrote a windows service application to call a function of another
object periodically. I used System.Server.Timer and I found that it works
fine within the first 2 hours but the onTimer event wouldn't be raised again
after few hours. I checked the msdn and Microsoft claims that it is a bug in
their .net framework as follows:
http://support.microsoft.com/default.aspx?scid=kb;en-us;842793
|
by: ELO |
last post by:
Hi all
Every week, I need to get two files on a remote server.
I have developped a C# Windows Service with two System.Threading.Timer to do this task
For the first one, the delay (TimeSpan dueTime) is always set to 6 days, 23 hours, 59 minutes, ..
Some weeks ?!?, the timer restarts immediately after its execution (and loop indefinitely). I have made a lot of tests and this issue does not occur with a delay < 1 day ..
Any suggestion
|
by: Skip Key |
last post by:
While writing a windows service, I've run into a fairly strange problem. I
have a worker proc that gets fired every n seconds using
System.Threading.Timer. This works fine, unless I open an SqlConnection on
it. Just as soon as I do so, the proc fires that time, and never again.
The connection is valid, I can do SQL commands on in with no problems, but
my timer goes away.
Here's a fairly simple console sample that shows the problem....
|
by: Stephen Rice |
last post by:
Hi,
I have a periodic problem which I am having a real time trying to sort.
Background:
An MDI VB app with a DB on SQL 2000.
I have wrapped all the DB access into an object which spawns a thread to
access the database and then displays a modal dialog which allows the user
to cancel the task, if it is taking longer than they want, and shows them a
display of how long the query has been running so far.
| |
by: r norman |
last post by:
Please excuse the cross-posting. This question was raised in
microsoft.public.dotnet.general but hasn't been answered so I am
trying where I can.
There are two of us who have the same problem in a service: the
Timer::Tick event processor never gets called. We have set the timer
interval, enabled it, and started it, but still nothing.
In my case, I also have enabled an event handler to detect
SessionSwitch, but that never gets...
|
by: fiefie.niles |
last post by:
I am having problem with thread. I have a Session class with public
string variable (called Message) that I set from my Main program. In
the session class it checks for the value of Message while inside it's
"read loop" waiting for data from the client. I find that many times
while inside the "read loop" it missed many of the value that was
assigned to the public Message variable.
For example, the main program send number 1 thru 100, but...
|
by: CCLeasing |
last post by:
For an application I'm creating I want to create a 'fake' progress
bar.
By fake I mean a progress bar that looks like it's doing something but
actually isn't.
I know philosophically this isn't sound. But my little app is a 'fake'
app and is designed to look like another - hence this seeming crazy
situation of needing to fake a progess bar.
PROBLEM.
|
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= |
last post by:
Hi,
i have a main thread an another worker thread.
The main Thread creates another thread and waits
for the threads signal to continue the main thread.
Everything works inside a ModalDialog and everyting
is secured by Invoke/BeginInvoke, and synchronisation
primitves like WaitHandles, Evetns, Semaphores, etc...
All works good and with no race conditions or locks.
I have a System.Windows.Forms.Timer in the main
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |