Visual Profiler



  • I'm currently working on a CUDA project for my uni, and it involves - well - profiling CUDA code. So I got myself Visual Profiler. It's nice, looks good for a Java app, gives me all the information I need. Cool.

    I had to collect a lot of metrics (and it seems that Visual Profiler collects even more "related" ones), so I end up with 5 24-row, 60-column tables. Now I need to extract some sensible data out of it, so I hit "export to CSV" and fire up the Almighty Excel.

    Whoops, some of the columns are misaligned. How's that so? Well, apparently when you export your data to CSV, all columns are separated by commas. You know what else is separated by commas in Visual Profiler?

    Fractions. Yes, "0,5" suddenly ends up as "0" and "5". There's no option to change that in the profiler, there's no option to change the CSV separator in the profiler, and it appears to ignore my system settings when I've set the decimal separator to a period. Fucking morons.

    Oh, but wait! It turns out that the Visual Profiler files are actually XML!

    ?xml version="1.0"?>
    session version="1" name="profiling" hscale="1.1028762841514688E-7">
    executable file=(...)> envs> /envs> /executable>
     expert>(...some event ids...) /expert>
    (...some column names or something...)
     timelinestate>(...some kernel headers...) /timelinestate>
     pdm>
    H4sIAAAAAAAAAJTdZVwV397GYcoCWxRU7BYVsVFUDLC7QFQEUezARjCwG/Vvdxd2dyeomNhgd2C3x5mbhfO7t/vFOZ/HZx3mey3ds87McrMFtoWNhcWf/7Ow/PP/LP+M6f78qtXRq1dwh465azX3zl2+XEmrP4ey//nl19q1XI/+3ft16d19cLN+/j0D/YMDG3dq5tfMr4v1n5wVpEwS6ewf3FEBGwPoq4c6PXoH9xqQBJL9iRl1UKFHr+COrXoFd0ssfw5aaDX9n1+FC6XUPrToVxVjsRwWFtcdLSyaWOA/yRIf6tKh6E7uNmmNrim5Lx7oXTtK14ycV1f0ZKula25w9n9+jfBKrvfr01MJ14Kc10z0TDula8m/3270Spela2Vwuf782pTSVu8dRtoK501u3ih0/2R2wvkYnLZyE0ujX60oXWuDS/XnV0gV9Kce0vmSy1UdvWUN6dqQU/27l3RtyZWqja5G5doZXJo/v2Lroe/4IJ2fwdn++fXyI3rrL9K1p/Wb/hXdYkp24fxp/
    (snipped: 60KB of seemingly Base64-encoded WTF)
     /pdm>
     /session>
    


  • Configure it to display every number with decimal places* then replace every other comma with a decimal point**.

    *I have no idea whether you can actually do this in Visual Profiler.

    **the replacement would actually need to be a little bit more complex to handle cells that contained text... I was able to create a Notepad++ macro that did it by replacing one occurrence of "([\d]*),([\d]+)" with "\1.\2", and then pressing the right arrow key once.



  • @Maciejasjmj said:

    and it appears to ignore my system settings when I've set the decimal separator to a period.

    I think you're an extreme optimist to even try that with a Java app.



  • Fun fact, Excel thinks that "comma separated values" should be semicolon separated in Sweden.



  • *I have no idea whether you can actually do this in Visual Profiler.

    Nope.

    I think you're an extreme optimist to even try that with a Java app.

    I figured that since it's using commas as decimal separators to begin with, it must rely on my regional settings, because I believe Java defaults to periods. But no such luck.



  • @henke37 said:

    Fun fact, Excel thinks that "comma separated values" should be semicolon separated in Sweden.

    Fun fact #2: Excel 2013 registers as opening CSV files, then it puts everything into cell A1. To open a CSV file properly, you need to select an option in one of the ribbons.



  • @henke37 said:

    Fun fact, Excel thinks that "comma separated values" should be semicolon separated in Sweden.
    Funner fact: a comma is just a semicolon that lacks the courage of its convictions.



  • With Excel, you can change the record separator when exporting to CSV by changing the setting under Region and language - additional settings. Whether or not this would also be reflected in Visual Profiler - I doubt it.



  • @Maciejasjmj said:

    hscale="1.1028762841514688E-7"

    Wait, does that mean each character is like 1/9000000 of its normal width?

     



  • @ceasar said:

    @Maciejasjmj said:

    hscale="1.1028762841514688E-7"

    Wait, does that mean each character is like 1/9000000 of its normal width?

     


    No, it means each character is 15625000/172324419398667 of its normal width. Sheesh.



  • @henke37 said:

    Fun fact, Excel thinks that "comma separated values" should be semicolon separated in Sweden.

    It's the same in the Netherlands, maybe it's an Europe thing? I thought it was always the case, but it's not in the USA?

    Then it makes an eenie-weenie little bit more sense, as most of Europe uses a comma as decimal point, so they probably once decided that ; should be the separator in Excel and now its a legacy mistake they're stuck with.



  • @dtech said:

    It's the same in the Netherlands, maybe it's an Europe thing? I thought it was always the case, but it's not in the USA?
    It's a locale thing.



  • @dtech said:

    @henke37 said:
    Fun fact, Excel thinks that "comma separated values" should be semicolon separated in Sweden.

    It's the same in the Netherlands, maybe it's an Europe thing? I thought it was always the case, but it's not in the USA?

    Then it makes an eenie-weenie little bit more sense, as most of Europe uses a comma as decimal point, so they probably once decided that ; should be the separator in Excel and now its a legacy mistake they're stuck with.

    Obviously it's a regional thing, but it was still a really bad idea. They did it with formulas, too...

    English:
    =SUM(1.2,3.4,5.6)

    Swedish:
    =SUMMA(1,2;3,4;5,6)

    ...yeah, that's a great idea.



  • @anotherusername said:

    @dtech said:
    @henke37 said:
    Fun fact, Excel thinks that "comma separated values" should be semicolon separated in Sweden.

    It's the same in the Netherlands, maybe it's an Europe thing? I thought it was always the case, but it's not in the USA?

    Then it makes an eenie-weenie little bit more sense, as most of Europe uses a comma as decimal point, so they probably once decided that ; should be the separator in Excel and now its a legacy mistake they're stuck with.

    Obviously it's a regional thing, but it was still a really bad idea. They did it with formulas, too...

    English:
    =SUM(1.2,3.4,5.6)

    Swedish:
    =SUMMA(1,2;3,4;5,6)

    ...yeah, that's a great idea.

     

     

    if the excel file remains in a standard english+, format it doesn't matter but they wouldn't have thought of that

     



  • @ratchet freak said:

    if the excel file remains in a standard english+, format it doesn't matter but they wouldn't have thought of that

    Small blessing. True; the Excel file can be saved and opened in a different location. All of the formulas will be automagically translated and the numbers and list separators converted into the correct regional display format. Still, who the hell ever thought that was a good idea?



  • @anotherusername said:

    @ratchet freak said:

    if the excel file remains in a standard english+, format it doesn't matter but they wouldn't have thought of that

    Small blessing. True; the Excel file can be saved and opened in a different location. All of the formulas will be automagically translated and the numbers and list separators converted into the correct regional display format. Still, who the hell ever thought that was a good idea?

    It's still moronic. You want to find some more advanced Excel feature, you go to the Microsoft site, and you either:

    a) get a page in English, which forces you to look up how the command is called in your native language

    b) get an useless machine-translated page

    You know what else used native-language commands? Logo. And that made sense, because it was made for fucking 8-year-olds.

    Also, as stated above - if your locale expects semicolons in CSV file, Excel 2013 just gives up when you open a comma-separated CSV via Explorer. You need to select "Data->Import from text" and only then you get a familiar CSV import window where you can specify delimiters. They can make Notepad guess the encoding, but they can't either make Excel guess the separators, or let you specify it when you're opening a CSV file via Explorer.


  • Considered Harmful

    @Maciejasjmj said:

    You know what else used native-language commands? Logo.

    Wow, there's a blast from the past.


  • Discourse touched me in a no-no place

    @Maciejasjmj said:

    it was made for fucking 8-year-olds
    That's illegal and immoral.



  • @dkf said:

    @Maciejasjmj said:
    it was made for fucking 8-year-olds
    That's illegal and immoral.

    Eight year olds, dude.



  • If you can get a hold at the actual command line that starts up the JVM (and it is not hidden in some EXE wrapper), try to add -Duser.language=en -Duser.country=US to the beginning of it (or at least before the first argument that does not start with a -). That way, Java will stop all its OS specific locale initialization stuff and just use the settings appropriate for the locale you specified (stored inside Java's default locale DB).



  • @mikeTheLiar said:

    @dkf said:
    @Maciejasjmj said:
    it was made for fucking 8-year-olds
    That's illegal and immoral.

    Eight year olds, dude.

    Hey, I didn't write that thing.

    If you can get a hold at the actual command line that starts up the JVM (and it is not hidden in some EXE wrapper), try to add -Duser.language=en -Duser.country=US to the beginning of it (or at least before the first argument that does not start with a -). That way, Java will stop all its OS specific locale initialization stuff and just use the settings appropriate for the locale you specified (stored inside Java's default locale DB).

    It's hidden in an EXE wrapper, and all the files except the said EXE wrapper are related to Eclipse. I honestly have no idea what's going on out there.

    I just ended up correcting the files manually in Excel. Less fun than it seems, since:

    a) if your value is stored up to three digits after the decimal point, you sometimes end up with two or one, and have no idea if that "5" was "500" and the profiler cut out the zeroes, or "005" and Excel cut out the zeroes, or "050" and both

    b) VP obviously helpfully doesn't store a 0 in the fractional part if the value is an integer, even if the rest of that column can have fractions.



  • @Maciejasjmj said:

    It's hidden in an EXE wrapper, and all the files except the said EXE wrapper are related to Eclipse.

    How to pass JVM arguments to an Equinox application (You want -vmargs)



  • @Arnavion said:

    @Maciejasjmj said:
    It's hidden in an EXE wrapper, and all the files except the said EXE wrapper are related to Eclipse.

    How to pass JVM arguments to an Equinox application (You want -vmargs)

    Hey, this worked! Thanks.

    Still, how the hell did they manage to get a decimal separator out of locale, but didn't either quote their numbers or get a list separator too is beyond me.



  • @Maciejasjmj said:

    Hey, this worked! Thanks.

    You're welcome.

    @Maciejasjmj said:

    Still, how the hell did they manage to get a decimal separator out of locale, but didn't either quote their numbers or get a list separator too is beyond me.

    They almost certainly aren't doing any locale-specific things themselves. They're probably doing double.toString() which uses the locale-specific decimal separator automatically (since it's for user-perceived output, not a serialization format) and writing that out to the file. Now, if they used an actual CSV library, the library would've escaped the commas for them, but presumably they also just join the doubles with "," themselves and write it out.


Log in to reply