Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - measure-object {get-process}

Reply
 
Old 05-21-2006   #1 (permalink)
Andrew Watt [MVP]


 
 

measure-object {get-process}

Using the command

measure-object {get-process}

I keep getting negative amounts of time returned.

Anyone else seeing this?

Thanks

Andrew Watt MVP

My System SpecsSystem Spec
Old 05-21-2006   #2 (permalink)
DBMwS


 
 

RE: measure-object {get-process}

I don't get negative numbers. In fact, I am not getting any output at all
Moreover, passing "{get-process}" doesn't run "get-process"
You have to make the statement to run using "&"

Anyways, I think you were trying to do something like "gps | Measure-Object
-InputObject { $_ }" or "Measure-Object (gps)" where the latter would not
work since "-InputObject" parameter accepts just one "PSObject".



"Andrew Watt [MVP]" wrote:

> Using the command
>
> measure-object {get-process}
>
> I keep getting negative amounts of time returned.
>
> Anyone else seeing this?
>
> Thanks
>
> Andrew Watt MVP
>

My System SpecsSystem Spec
Old 05-21-2006   #3 (permalink)
Andrew Watt [MVP]


 
 

Re: measure-object {get-process}

Apologies.

I meant to write

measure-command {get-process}

Andrew Watt MVP


On Sun, 21 May 2006 11:45:01 -0700, DBMwS
<DBMwS@discussions.microsoft.com> wrote:

>I don't get negative numbers. In fact, I am not getting any output at all
>Moreover, passing "{get-process}" doesn't run "get-process"
>You have to make the statement to run using "&"
>
>Anyways, I think you were trying to do something like "gps | Measure-Object
>-InputObject { $_ }" or "Measure-Object (gps)" where the latter would not
>work since "-InputObject" parameter accepts just one "PSObject".
>
>
>
>"Andrew Watt [MVP]" wrote:
>
>> Using the command
>>
>> measure-object {get-process}
>>
>> I keep getting negative amounts of time returned.
>>
>> Anyone else seeing this?
>>
>> Thanks
>>
>> Andrew Watt MVP

My System SpecsSystem Spec
Old 05-21-2006   #4 (permalink)
/\\/\\o\\/\\/


 
 

Re: measure-object {get-process}

Andrew Watt [MVP] wrote:
> Apologies.
>
> I meant to write
>
> measure-command {get-process}
>
> Andrew Watt MVP
>
>
> On Sun, 21 May 2006 11:45:01 -0700, DBMwS
> <DBMwS@discussions.microsoft.com> wrote:
>
>> I don't get negative numbers. In fact, I am not getting any output at all
>> Moreover, passing "{get-process}" doesn't run "get-process"
>> You have to make the statement to run using "&"
>>
>> Anyways, I think you were trying to do something like "gps | Measure-Object
>> -InputObject { $_ }" or "Measure-Object (gps)" where the latter would not
>> work since "-InputObject" parameter accepts just one "PSObject".
>>
>>
>>
>> "Andrew Watt [MVP]" wrote:
>>
>>> Using the command
>>>
>>> measure-object {get-process}
>>>
>>> I keep getting negative amounts of time returned.
>>>
>>> Anyone else seeing this?
>>>
>>> Thanks
>>>
>>> Andrew Watt MVP

OK here

Measure-Command {get-process}Measure-Command {get-process}
....
TotalMilliseconds : 2.2503

gr /\/\o\/\/

My System SpecsSystem Spec
Old 05-21-2006   #5 (permalink)
Andrew Watt [MVP]


 
 

Re: measure-object {get-process}

On Sun, 21 May 2006 21:22:30 +0200, "/\\/\\o\\/\\/" <no@spam.mow>
wrote:

>Andrew Watt [MVP] wrote:
>> Apologies.
>>
>> I meant to write
>>
>> measure-command {get-process}
>>
>> Andrew Watt MVP
>>
>>
>> On Sun, 21 May 2006 11:45:01 -0700, DBMwS
>> <DBMwS@discussions.microsoft.com> wrote:
>>
>>> I don't get negative numbers. In fact, I am not getting any output at all
>>> Moreover, passing "{get-process}" doesn't run "get-process"
>>> You have to make the statement to run using "&"
>>>
>>> Anyways, I think you were trying to do something like "gps | Measure-Object
>>> -InputObject { $_ }" or "Measure-Object (gps)" where the latter would not
>>> work since "-InputObject" parameter accepts just one "PSObject".
>>>
>>>
>>>
>>> "Andrew Watt [MVP]" wrote:
>>>
>>>> Using the command
>>>>
>>>> measure-object {get-process}
>>>>
>>>> I keep getting negative amounts of time returned.
>>>>
>>>> Anyone else seeing this?
>>>>
>>>> Thanks
>>>>
>>>> Andrew Watt MVP

>OK here
>
>Measure-Command {get-process}Measure-Command {get-process}
>...
>TotalMilliseconds : 2.2503
>
>gr /\/\o\/\/


Interesting.

For me:

measure-command {get-process}


Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : -312
Ticks : -3122598
TotalDays : -3.61411805555556E-06
TotalHours : -8.67388333333333E-05
TotalMinutes : -0.00520433
TotalSeconds : -0.3122598
TotalMilliseconds : -312.2598

It does sometimes (not sure why) give a positive value around 4ms.

Can give divergent results (i.e. believable positive time and less
credible negative time) when run twice within seconds of each other.

Andrew Watt MVP
My System SpecsSystem Spec
Old 05-21-2006   #6 (permalink)
dreeschkind


 
 

Re: measure-object {get-process}

I don't get negative results, did you file a bug already?

PoSh 1 C:\>1..10 | % { Measure-Command { get-process } } | % {
$_.TotalMilliseconds }
4,2815
4,3323
3,7884
3,9505
6,2644
15,8919
4,196
6,4463
16,9566
13,4299

--
greetings
dreeschkind

"Andrew Watt [MVP]" wrote:

> On Sun, 21 May 2006 21:22:30 +0200, "/\\/\\o\\/\\/" <no@spam.mow>
> wrote:
>
> >Andrew Watt [MVP] wrote:
> >> Apologies.
> >>
> >> I meant to write
> >>
> >> measure-command {get-process}
> >>
> >> Andrew Watt MVP
> >>
> >>
> >> On Sun, 21 May 2006 11:45:01 -0700, DBMwS
> >> <DBMwS@discussions.microsoft.com> wrote:
> >>
> >>> I don't get negative numbers. In fact, I am not getting any output at all
> >>> Moreover, passing "{get-process}" doesn't run "get-process"
> >>> You have to make the statement to run using "&"
> >>>
> >>> Anyways, I think you were trying to do something like "gps | Measure-Object
> >>> -InputObject { $_ }" or "Measure-Object (gps)" where the latter would not
> >>> work since "-InputObject" parameter accepts just one "PSObject".
> >>>
> >>>
> >>>
> >>> "Andrew Watt [MVP]" wrote:
> >>>
> >>>> Using the command
> >>>>
> >>>> measure-object {get-process}
> >>>>
> >>>> I keep getting negative amounts of time returned.
> >>>>
> >>>> Anyone else seeing this?
> >>>>
> >>>> Thanks
> >>>>
> >>>> Andrew Watt MVP

> >OK here
> >
> >Measure-Command {get-process}Measure-Command {get-process}
> >...
> >TotalMilliseconds : 2.2503
> >
> >gr /\/\o\/\/

>
> Interesting.
>
> For me:
>
> measure-command {get-process}
>
>
> Days : 0
> Hours : 0
> Minutes : 0
> Seconds : 0
> Milliseconds : -312
> Ticks : -3122598
> TotalDays : -3.61411805555556E-06
> TotalHours : -8.67388333333333E-05
> TotalMinutes : -0.00520433
> TotalSeconds : -0.3122598
> TotalMilliseconds : -312.2598
>
> It does sometimes (not sure why) give a positive value around 4ms.
>
> Can give divergent results (i.e. believable positive time and less
> credible negative time) when run twice within seconds of each other.
>
> Andrew Watt MVP
>

My System SpecsSystem Spec
Old 05-22-2006   #7 (permalink)
Andrew Watt [MVP]


 
 

Re: measure-object {get-process}

I've bugged it now:
https://connect.microsoft.com/feedba...edbackID=78415

Andrew Watt MVP

On Sun, 21 May 2006 17:09:03 -0700, dreeschkind
<dreeschkind@discussions.microsoft.com> wrote:

>I don't get negative results, did you file a bug already?
>
>PoSh 1 C:\>1..10 | % { Measure-Command { get-process } } | % {
>$_.TotalMilliseconds }
>4,2815
>4,3323
>3,7884
>3,9505
>6,2644
>15,8919
>4,196
>6,4463
>16,9566
>13,4299

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to use measure-object against multiple file types PowerShell
Problem with Measure-Object on get-process PowerShell
Adding canonical aliases for Compare-Object, Measure-Object, New-Object PowerShell
Default display for measure-object PowerShell
Multiple errors in help for measure-object PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46