![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Questions, questions, questions... on how to improve Hey guys, running my logscript has made me ponder a few things, and I have some questions that perhaps you scripting pros especially could help me out with. One of them being that maaaby, I should've done the appendfile thingy after each logfile hehe. But you know, that's why I did the script, to learn from it. So I've thought about it for some days, and have some questions: 1. Is there a way to increase performance by reading blocks of data from the logfiles, instead of line by line ? 2. If I was to add a progress indicator, wouldn't that need to know how many files in total it's looking through, to be able to scale the indicator accordingly ? I'm thinking about doing a progress indicator for: - Progress in relation to the current logfile - In relation to the current folder - In relation to the total number of files 3. I'm considering also displaying a counter for how many results it's found. Is there a way to statically define a variable that's shown on screen, and when the value is updated, it's updated on screen, but not in a new screen position ? (I know Rexx had this in OS/2) 4. Also considering displaying some metrics. How much data, how many files, how many lines exactly, etc. Any obvious cmdlets or methods to use here, other then getting filesizes, counting lines in a log- file, etc. ? Hope you can help me out with those questions. It's funny how when you've made a script like that, and you're running it (especially on such amounts of data), the obvious lacks tend to get in your face pretty quick ![]() But it's all good, I'm hoping to learn from it, and I'm hoping you can help me out a bit, learning ![]() Best Regards, Jacob Saaby Nielsen mailto:jacob.saaby@xxxxxx |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Questions, questions, questions... on how to improve Wow... Noone has any input on these thoughts ? I would think that everyone could learn from the answers, but perhaps I was wrong. Best Regards, Jacob Saaby Nielsen mailto:jacob.saaby@xxxxxx Quote: > Hey guys, > > running my logscript has made me ponder a few things, and I have some > questions > that perhaps > you scripting pros especially could help me out with. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Questions, questions, questions... on how to improve Jacob Saaby Nielsen wrote: Quote: > Hey guys, > > running my logscript has made me ponder a few things, and I have some > questions that perhaps > you scripting pros especially could help me out with. > > One of them being that maaaby, I should've done the appendfile thingy > after each logfile hehe. > > But you know, that's why I did the script, to learn from it. So I've > thought about it for some days, > and have some questions: > > 1. Is there a way to increase performance by reading blocks of data from > the logfiles, instead of > line by line ? objects are read in. If you're doing: get-content file|some_function or get-content file|some_filter A filter is acting on each object (each line) as it is retrieved by get-content, and passing that on. A function will wait for get-content to read the entire file. It is a matter of testing as functions and filters are basically structured the same way. Will reading blocks do better? I think a filter will do a better job at reading bigger log files, and I'll try to demo that today/over the weekend maybe. Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Questions, questions, questions... on how to improve Quote: > 2. If I was to add a progress indicator, wouldn't that need to know how > many files in total it's looking > through, to be able to scale the indicator accordingly ? I'm thinking > about doing a progress indicator > for: > > - Progress in relation to the current logfile > - In relation to the current folder > - In relation to the total number of files write progress beforehand though. See 'help write-progress -examples' for some ideas. Marco |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Questions, questions, questions... on how to improve Hey Marco, thanks. I'll try do rewrite with a filter instead My script is STILL running(6 days after I started it), and I see that it's because it doesn't get a lot of CPU time by now. However, there are no other processes that use the cpu on that machine. Is there some kind of built in "if the script has run for this long, I'll downthrottle the cpu usage" ? Best Regards, Jacob Saaby Nielsen mailto:jacob.saaby@xxxxxx Quote: > Jacob Saaby Nielsen wrote: > Quote: >> Hey guys, >> >> running my logscript has made me ponder a few things, and I have some >> questions that perhaps >> you scripting pros especially could help me out with. >> One of them being that maaaby, I should've done the appendfile thingy >> after each logfile hehe. >> >> But you know, that's why I did the script, to learn from it. So I've >> thought about it for some days, >> and have some questions: >> 1. Is there a way to increase performance by reading blocks of data >> from >> the logfiles, instead of >> line by line ? > objects are read in. > > If you're doing: > get-content file|some_function > or > get-content file|some_filter > A filter is acting on each object (each line) as it is retrieved by > get-content, and passing that on. A function will wait for > get-content to read the entire file. > > It is a matter of testing as functions and filters are basically > structured the same way. > > Will reading blocks do better? I think a filter will do a better job > at reading bigger log files, and I'll try to demo that today/over the > weekend maybe. > > Marco > > PowerGadgets MVP > http://www.powergadgets.com/mvp > Blog: > http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Questions, questions, questions... on how to improve (WHAT an improvement !!!) Hey Marco, I'm just playing around with my script right now. It seems if you put -readcount on get-content, it DRAMATICALLY increases the performance ! I have a set of logfiles I'm running my script on for test purposes. It consists of 91 logfiles, taking up 87mb of space. With -readcount 500 the script plows through them in 10 seconds flat. Without -readcount... well, now I understand why my original script performs like a mule on the Nürnberg Ring. It takes 9 minutes 22 seconds !!! That's ... an insane difference ! 562 seconds without -readcount. 10 seconds with. I ran the script twice, just to verify that it wasn't a one time deal. 9 minutes 17 seconds the second time without -readcount. Only worry I have, is that when I set -readcount to 500, there was a difference in the output. Without -readcount, the list was full, with readcount, 2 names were missing in the list. But upping -readcount to 1000 fixed it. Any take on what might've happened there ? Seems blockreading is a good thing after all ![]() Best Regards, Jacob Saaby Nielsen mailto:jacob.saaby@xxxxxx Quote: > Jacob Saaby Nielsen wrote: > Quote: >> Hey guys, >> >> running my logscript has made me ponder a few things, and I have some >> questions that perhaps >> you scripting pros especially could help me out with. >> One of them being that maaaby, I should've done the appendfile thingy >> after each logfile hehe. >> >> But you know, that's why I did the script, to learn from it. So I've >> thought about it for some days, >> and have some questions: >> 1. Is there a way to increase performance by reading blocks of data >> from >> the logfiles, instead of >> line by line ? > objects are read in. > > If you're doing: > get-content file|some_function > or > get-content file|some_filter > A filter is acting on each object (each line) as it is retrieved by > get-content, and passing that on. A function will wait for > get-content to read the entire file. > > It is a matter of testing as functions and filters are basically > structured the same way. > > Will reading blocks do better? I think a filter will do a better job > at reading bigger log files, and I'll try to demo that today/over the > weekend maybe. > > Marco > > PowerGadgets MVP > http://www.powergadgets.com/mvp > Blog: > http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Questions, questions, questions... on how to improve (WHAT animprovement !!!) Jacob Saaby Nielsen wrote: Quote: > Hey Marco, > > I'm just playing around with my script right now. It seems if you put > -readcount on get-content, > it DRAMATICALLY increases the performance ! > > I have a set of logfiles I'm running my script on for test purposes. It > consists of 91 logfiles, > taking up 87mb of space. > With -readcount 500 the script plows through them in 10 seconds flat. > > Without -readcount... well, now I understand why my original script > performs like a mule on the > Nürnberg Ring. It takes 9 minutes 22 seconds !!! > > That's ... an insane difference ! 562 seconds without -readcount. 10 > seconds with. I ran the script > twice, just to verify that it wasn't a one time deal. 9 minutes 17 > seconds the second time without > -readcount. > Only worry I have, is that when I set -readcount to 500, there was a > difference in the output. Without > -readcount, the list was full, with readcount, 2 names were missing in > the list. But upping -readcount > to 1000 fixed it. Any take on what might've happened there ? > > Seems blockreading is a good thing after all ![]() As for dropping lines, I will try to do a test. Could be a bug if it can be reproduced. Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Questions, questions, questions... on how to improve (WHAT animprovement !!!) Hey Marco, yeah, I guess sometimes the docs can actually be useful ![]() Anyway, the updated version is posted here, if anyone would like to take a look and/or be inspired. http://www.pipforhelvede.net/post/20...Version-2.aspx Best Regards, Jacob Saaby Nielsen mailto:jacob.saaby@xxxxxx Quote: > Jacob Saaby Nielsen wrote: > > Good job reading the docs... ;-) I forgot about that parameter. > > As for dropping lines, I will try to do a test. Could be a bug if it > can be reproduced. > > Marco > > PowerGadgets MVP > http://www.powergadgets.com/mvp > Blog: > http://marcoshaw.blogspot.com |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| 32/64 bit questions & DirectX 9/10 questions :) | Gaming | |||
| 3 Questions | Live Mail | |||
| Two questions | Vista performance & maintenance | |||
| Two questions | Vista mail | |||
| 5 Questions - please help | Vista General | |||