Go Back   Winamp Forums > Skinning and Design > Modern Skins

Reply
Thread Tools Search this Thread Display Modes
Old 11th October 2005, 10:23   #1
rohan_pwln
Major Dude
 
rohan_pwln's Avatar
 
Join Date: Aug 2002
Location: 18 inches from hell
Posts: 736
loadTime : Calculates time taken to load a skin

I have made two scripts, init.m and end.m that calculate the time taken for a skin to load.

Usage

<script id="loadtime.initializer" file="scripts/init.maki"/> i.e the line calling the 'init.maki' script should be first initialized. Considering that the first line(s) i.e <wasabiXML>, then <?xml doctype="---" encoding="---"?> as line '0', this line(the line calling the script) should be place at line 1 i.e the line just below the <wasabiXML> and rest, just before <skininfo> (not neccesarily, as <skininfo> can appear anywhere).

<script id="loadtime.initializer" file="scripts/init.maki"/> i.e the line caling the 'end.maki' script should be placed last, after all includes and the rest. I'll give you an example, of how to place these files in your skin.xml file:

code:

<WinampAbstractionLayer version="0.8">
<script id="loadTime.initializer" file="scripts/init.maki"/> // The first line

<skininfo>
<version>1.0</version>
<name></name>
<comment>Nothing much </comment>
<author>Quadhelix + hammerhead + rohan2kool</author>
<email>j106_vulcan@hotmail.com</email>
<homepage></homepage>
<screenshot>skinshot.png</screenshot>
</skininfo>

<include file="xml/system-colors.xml"/> //The includes
<include file="xml/player.xml"/>

<include file="xml/system-elements.xml"/>
<include file="xml/standardframe.xml"/>
<include file="xml/xuiobjects.xml"/>
<include file="xml/message.xml" />
<include file="xml/eq.xml"/> //The includes

<include file="xml/gamma-presets.xml"/> //The includes

<script id="scripts.quicksongpick" file="scripts/quicksongpick.maki"/>
<script id="effectCore" file="scripts/effectcore.maki"/>
<script id="loadTime.reporter" file="scripts/end.maki"/> //The last line

</WinampAbstractionLayer>



Actually, I was making this for vortex, the skin project started by QuadHelix.

When, the skin finishes loading, a messagebox is displayed which tells the time taken for the skin to load. This is for demo purposes only.

Applications

You can use it to assess the computing power of the computer on which it is loaded and change the various settings like desktopAlpha, ticker scrolling etc. automatically.

Source Code

init.m
code:

/*
+-----------------------------------------------------------+
|loadTime |
|-----------------------------------------------------------|
|By: Rohan Prabhu |
|Purpose: To track the time taken for a skin to load |
|Application: To tweak the properties of the skin(like |
| DesktopAlpha and so on according to the power |
| of the computer |
|mail: rohan2kool@gmail.com |
+-----------------------------------------------------------+
|-----init.m |
+-----------------------------------------------------------+
| Sets the counter starting to count time until the loop is |
| interrupted by a breach which is caused by end.m |
| |
| Every 1 time unit, a PrivateInt is updated(incremented) |
| until interrupted by the breach. |
+-----Define Units------------------------------------------+
| INT_FETCH_SEGMENT : defines the section in which the |
| PrivateInt is stored. |
+-----------------------------------------------------------+
*/

#include <std.mi>
#define INT_FETCH_SEGMENT "vortex"

#ifndef INT_FETCH_SEGMENT
#error PrivateInt segment must be defined
#endif

Global timer account;
Global int x=0;

System.onScriptLoaded() {
account = new Timer;
account.setDelay(0.01);
account.start();
}

account.onTimer() {
x+=1;
if(System.getPrivateInt("vortex", "loadTime", 1)) {
System.setPrivateInt(INT_FETCH_SEGMENT, "loadTimeCount", x);
} else {
account.stop();
System.setPrivateInt(INT_FETCH_SEGMENT, "loadTime", 1);
}
}



end.m
code:

/*
+-----------------------------------------------------------+
|loadTime |
|-----------------------------------------------------------|
|By: Rohan Prabhu |
|Purpose: To track the time taken for a skin to load |
|Application: To tweak the properties of the skin(like |
| DesktopAlpha and so on according to the power |
| of the computer |
|mail: rohan2kool@gmail.com |
+-----------------------------------------------------------+
|-----end.m |
+-----------------------------------------------------------+
| Breaches the loop of init.m and returns the total time |
+-----Define Units------------------------------------------+
| INT_FETCH_SEGMENT : defines the section in which the |
| PrivateInt is stored. |
| |
| TIME_UNITS : defines the unit of time |
+-----------------------------------------------------------+
*/

#include <std.mi>

#define TIME_UNITS " time units"
#define INT_FETCH_SEGMENT "vortex"

#ifndef TIME_UNITS
#define TIME_UNITS " time units"
#endif

#ifndef INT_FETCH_SEGMENT
#error PrivateInt segment must be defined
#endif

System.onScriptLoaded() {
System.setPrivateInt("vortex", "loadTime", 4);
messagebox("The skin loaded in " + integertostring(System.getPrivateInt(INT_FETCH_SEGMENT,
"loadTimeCount", 0)) + TIME_UNITS, "LoadTime", 1, "");
}



For the definations and all, read the comments in th scripts.

Download

The file is attatched which contains the compiled .maki files(compiled with compiler for winamp 5.03(mc.exe)) and also the source code files(i.e .m files)

License

Feel free to use it in your skins, but please put the source files with your skin. It is not compulsory to put the source files, but it's a request from my side to do so, with the comments intact

Lastly...

Thanks for viewing this post. Hope this is of help to you. Please post your comments.
Attached Files
File Type: zip loadtime.zip (3.9 KB, 57 views)

My MAKI contribs.: STONE
My WebSite My Blog My Skins: fnk 32 Rioport v1 Sienna Burning Steel
My Saying: Eat healthy, Stay fit... Die Anyway
rohan_pwln is offline   Reply With Quote
Old 11th October 2005, 10:50   #2
Mr Jones
Nothing to say...
 
Mr Jones's Avatar
 
Join Date: Sep 2000
Location: UK
Posts: 23,020
How are you factoring in different load times on different machines?

If you are using this as an aid for developing skins and to check load rates etc etc, then what might load in a split second on my super duper 2.8ghz p4, might load in 10 seconds on my old 400mhz p2

Or have I misunderstood the nature of the script?
Mr Jones is offline   Reply With Quote
Old 11th October 2005, 11:12   #3
Michgelsen
Major Dude
 
Michgelsen's Avatar
 
Join Date: Oct 2003
Location: Netherlands
Posts: 1,416
A delay of 0.01 milliseconds!?
I thought it was limited to 10 ms...
Michgelsen is offline   Reply With Quote
Old 11th October 2005, 12:04   #4
SLoB
Major Dude
 
SLoB's Avatar
 
Join Date: Jul 2003
Location: UK
Posts: 1,316
seems a bit pointless unless the skin is taking forever to load
if it is worth while doing then...
ideally you would want to time when each script is loaded and store a time against each (including xml files), that way you can track which script takes the longest to load?

if the skin loads up in a reasonable time then thats good enuff innit?
I would only question the load up time if it takes more than say 5 seconds
SLoB is offline   Reply With Quote
Old 11th October 2005, 12:10   #5
Michgelsen
Major Dude
 
Michgelsen's Avatar
 
Join Date: Oct 2003
Location: Netherlands
Posts: 1,416
That's pretty long, 5 seconds...
Unless of course you compare it to Anunaki's loading time
Michgelsen is offline   Reply With Quote
Old 11th October 2005, 12:12   #6
SLoB
Major Dude
 
SLoB's Avatar
 
Join Date: Jul 2003
Location: UK
Posts: 1,316
5 seconds was a conservative putmyfingerintheairestimate
SLoB is offline   Reply With Quote
Old 11th October 2005, 13:02   #7
rpeterclark
Major Dude
(Reviewer)
 
rpeterclark's Avatar
 
Join Date: Aug 2002
Location: South Florida
Posts: 1,387
I don't think using a Timer for this can be very accurate, it seems like the delay value isn't precise and I think it's rate can be further adjusted in the preferences under "Timer Resolution" or something like that.

A more consistent value would probably be System. getTimeOfDay(), which returns the number of milliseconds since the start of the day. Check the getTimeOfDay() again in your end script and you should have an accurate measure of how long it took to load.

My guess is the difference can vary widely with the same skin on different machines, but it's an interesting tool.
rpeterclark is offline   Reply With Quote
Old 11th October 2005, 14:15   #8
rohan_pwln
Major Dude
 
rohan_pwln's Avatar
 
Join Date: Aug 2002
Location: 18 inches from hell
Posts: 736
Dear rpeterclark sir,

You have cracked it. Because using a timer is innacurate, i have mentioned it as 'time units' and not as 'seconds'. This is a cool way of doing it(god knows why it didn't strike me??) and i am going to implement it.

Again, as i have already mentioned that i have always considered you as my guru, i pass on my sincere thanks to you for commenting on my tool.

~rohan

My MAKI contribs.: STONE
My WebSite My Blog My Skins: fnk 32 Rioport v1 Sienna Burning Steel
My Saying: Eat healthy, Stay fit... Die Anyway
rohan_pwln is offline   Reply With Quote
Old 11th October 2005, 14:21   #9
rohan_pwln
Major Dude
 
rohan_pwln's Avatar
 
Join Date: Aug 2002
Location: 18 inches from hell
Posts: 736
To everybody,

I know that skins take different times to load on different PCs. But that's the purpose of this skin. On every PC, when the skin is installed, some might be powerful to run desktopAlpha, multi-bit transperent animatedLayers at a delay of 1ms... and so on. This tool can be used to devlopers to set the settings in a way so that the skin is tweaked for perfect working on the PC.

The messageBox is only for demonstration purposes. The PrivateInt declared using this tool can be then accesed from various other scripts and can be used to tweak the skin.

My MAKI contribs.: STONE
My WebSite My Blog My Skins: fnk 32 Rioport v1 Sienna Burning Steel
My Saying: Eat healthy, Stay fit... Die Anyway
rohan_pwln is offline   Reply With Quote
Old 11th October 2005, 15:37   #10
Mr Jones
Nothing to say...
 
Mr Jones's Avatar
 
Join Date: Sep 2000
Location: UK
Posts: 23,020
feature suggestion for you, if it returns a value larger than say 5 seconds, make a pop up box that suggests the user ditch their pc or go back to using classic skins
Mr Jones is offline   Reply With Quote
Old 11th October 2005, 17:25   #11
corwwin
Senior Member
 
corwwin's Avatar
 
Join Date: Mar 2002
Location: Kingdom of Amber
Posts: 263
What are 5 seconds, or even 10, compared to a lifetime?
I find this tool pretty useless... execept if its purpose is to demonstrate its author's skill. But everyone knows we're here in a high-level-brains community.
corwwin is offline   Reply With Quote
Old 11th October 2005, 17:44   #12
rohan_pwln
Major Dude
 
rohan_pwln's Avatar
 
Join Date: Aug 2002
Location: 18 inches from hell
Posts: 736
well, corwwin, this tool is not for telling people how much the skin took to load. It is for convinience for the user. The time is an assesment of the computing power of a PC and hence skin can change the settings so as to be fast on that specific computer. Read my post below:

Quote:
Originally Posted By rohan_pwln
To everybody,

I know that skins take different times to load on different PCs. But that's the purpose of this skin. On every PC, when the skin is installed, some might be powerful to run desktopAlpha, multi-bit transperent animatedLayers at a delay of 1ms... and so on. This tool can be used to devlopers to set the settings in a way so that the skin is tweaked for perfect working on the PC.

The messageBox is only for demonstration purposes. The PrivateInt declared using this tool can be then accesed from various other scripts and can be used to tweak the skin.

My MAKI contribs.: STONE
My WebSite My Blog My Skins: fnk 32 Rioport v1 Sienna Burning Steel
My Saying: Eat healthy, Stay fit... Die Anyway
rohan_pwln is offline   Reply With Quote
Old 11th October 2005, 18:15   #13
corwwin
Senior Member
 
corwwin's Avatar
 
Join Date: Mar 2002
Location: Kingdom of Amber
Posts: 263
Rohan, I appreciate your work and I know you're going further and further in skinning art. I was just trying to say that a basic user like I am doesn't care a lot about cpu consumption or loading time. I run now a 1.6 GHz cpu (don't ask me much more!), and it runs faster than my previous 133 Mhz. Weird, isn't it? I made a skin with lot of gfx, scripts and anims, using 100% of CPU. Well, if I want to work seriously with 3D-CAD progs or 3D Studio, I switch to the classic wa2 skin and turn off AVS to spare CPU. If I just want to hear music, have a nice pic on my screen and play around with the buttons, I use one of these marvelous bunch-of-featured skins created by the maki gurus like you.
But I guess that your pleasure is to write hard scripts developping new (ofte, useless) features, rather than to make user-friendky skins, and this makes me smile.
corwwin is offline   Reply With Quote
Old 11th October 2005, 19:47   #14
Michgelsen
Major Dude
 
Michgelsen's Avatar
 
Join Date: Oct 2003
Location: Netherlands
Posts: 1,416
You have a point corwwin
Michgelsen is offline   Reply With Quote
Old 11th October 2005, 20:15   #15
corwwin
Senior Member
 
corwwin's Avatar
 
Join Date: Mar 2002
Location: Kingdom of Amber
Posts: 263
thanx
corwwin is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump