Headline Benchmark

Any version for mac users like me? I can package for mac if you want to.

I want to do a Mac version, but I need some help with the OS-specific code… How to get the CPU name and system memory on a mac?

Also, I don’t have a mac to test on… :frowning:

Maybe this can help you.

SIGAR - System Information Gatherer And Reporter

I can write a C program to get those details. Can you just execute it and capture the output?

Okay, here’s the program.


#include <sys/types.h>
#include <sys/sysctl.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    char buf[100];
    size_t buflen = 100;

    sysctlbyname("machdep.cpu.brand_string", &buf, &buflen, NULL, 0);
    printf("%s\n", buf);

    int mib[] = { CTL_HW, HW_MEMSIZE };
    int64_t value = 0;
    size_t length = sizeof(value);

    if (sysctl(mib, 2, &value, &length, NULL, 0) == -1)
    {
        printf("RAM SIZE: Unknown\n");
        return -1;
    }

    printf("RAM SIZE: %lld BYTES\n", value);
}

And this is the produced output.


Pentium(R) Dual-Core  CPU      E5300  @ 2.60GHz
RAM SIZE: 4294967296 BYTES

Cool, but keeping this to java…? For example, I I do Runtime.exex() to get this info through WMIC on Windows, and read /proc on Linux.

Why not use JNI? Or is there any better option? Can you post the code you use Runtime.exec() on windows? How are you parsing that information?

It’s not pretty but it works - I’m hoping that I can feed some similar code AppleScript:

private static String doWmic(String alias, String whatToGet) { try { String command = "wmic " + alias + " get " + whatToGet; String executeCommand = CommandExecutor.executeCommand(command); String result = executeCommand.substring(executeCommand.indexOf("\n")).trim(); if ("".equals(whatToGet)) result = "\n" + result; return cleanUp(result); } catch (Exception ignore) { if ("cpu".equals(alias)) { try { return WinRegistryMain.getCpuName(); } catch (Throwable t) { Benchmark.handleError(ErrorHandler.ErrorLevel.major, "An error occurred while doing a Windows command.", WindowsSystemInfo.class, t); return "0"; } } Benchmark.handleError(ErrorHandler.ErrorLevel.major, "An error occurred while doing a Windows command.", WindowsSystemInfo.class, ignore); return "0"; } }

And CommandExecutor does this:

public static String executeCommand(String command) { Runtime rt = Runtime.getRuntime(); StreamWrapper error, output; try { Process proc = rt.exec(command); error = getStreamWrapper(proc.getErrorStream(), "ERROR"); output = getStreamWrapper(proc.getInputStream(), "OUTPUT"); error.start(); output.start(); error.join(20 * 1000); output.join(20 * 1000); proc.waitFor(); return output.message; } catch (Exception e) { Benchmark.handleError(ErrorHandler.ErrorLevel.major, "An error occurred while executing an operating system-specific command: " + command, CommandExecutor.class, e); return "0"; } }

I just got a result from one of the new radeon cards. My worst nightmare has been confirmed. These cards make no effort to identify themselves properly… all i know is that this card is a:

AMD Radeon R9 200 Series

280? 280X? 290? 290X?

Does that mean all AMD will tell me about the R7 cards is that they are R7 200 Series? How an I supposed to produce anything sensible from that?

Does anybody know of a way to get a better name for a graphics card than the GL_STRING approach I’m currently using?

@ags1

Here’s some code using JAVA and APPLESCRIPT.

AppleScript


set theInfo to do shell script "/usr/sbin/system_profiler -detailLevel mini | egrep '(Processor Name|Processor Speed|Memory): ' | cut -d: -f2-"
set AppleScript's text item delimiters to return
set theList to text items of theInfo
set AppleScript's text item delimiters to "" -- get results
item 1 of theList -- Cpu Name
item 2 of theList -- cpu Speed
item 3 of theList -- Ram

set output to (item 1 of theList & " " & item 2 of theList & " XXXXX " & item 3 of theList)

do shell script "echo " & output

Java code


import java.io.BufferedReader;
import java.io.InputStreamReader;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class OSXSystemInfo
{

    public static void main(String[] args) throws ScriptException
    {
        ScriptEngineManager mgr = new ScriptEngineManager();
        ScriptEngine engine = mgr.getEngineByName("AppleScript");
        
        String[] output = ((String) engine.eval(new BufferedReader
                                             (new InputStreamReader(
                                                                    OSXSystemInfo.class.getResourceAsStream("/OSXInfoScript.scpt")
                                             )))).split("XXXXX");
        
        System.out.println("PROCESSOR: " + output[0].trim());
        System.out.println("RAM: " + output[1].trim());
    }
    
}

Output


PROCESSOR: Intel Core 2 Duo 2.62 GHz
RAM: 4 GB

Will you give me a credit?

Thanks! I’d better start adding that credits page!

I had the idea to get more detailed information about the GPU through the OpenCL API, but that seems a bit crashy. at least I get native code exceptions when i just try and create a context with my radeon 3450M. I won’t blame Jogamp, I guess support for OpenCL is pretty patchy, particularly on older or less mature drivers. So that idea bites the dust. Maybe there is something in GL capabilities that I can use.

Well, that was fun. Watching my computer transform into a jet turbine and fly around the room, barely held down by its power cord! ;D

I don’t think that the results were submitted though, I got a ‘not supported error’ in the terminal when I hit submit… still fun.

On some varieties of Linux the results won’t get submitted because the OS doesn’t support java.awt.Desktop. The submission URL is however written to headline-benchmark-trace.txt in your home directory, and you can manually paste it into a browser to manually submit.

Headline Benchmark reached 100 dowloads today. It’s an internet sensation! Champagne all around!

Windows 64 bit: 55 downloads
Windows 32 bit: 21 downloads
Linux 64 bit: 13 dowloads
Linux 32 bit: 6 downloads
CLI: 5 downloads

No mac binary still…
Can you send me a debug build? I want to test it right now.

Hi sorry, I’ve been busy remodelling my house.

I will get the mac binary up ASAP!

I added SHCs code and built a MAC binary. The website is not updated (it is untested code) but here is a link to download the binary:

https://bitbucket.org/aclarke/headline-distribution/downloads#download-304630

Good luck, and let me know what happens!

PS: The next update will include a Credits screen, much needed for the many people who have helped me :slight_smile:

EDIT…

Hey SHC, that was quick! But why do you have a None graphics processor? The string “None” is being returned by my OpenGL calls…

@ags1

I’ve used the command line version and that’s why it is None graphics card. I’ll upload the new results.

Headline Benchmark is now on Google Play for Android:

https://play.google.com/store/apps/details?id=com.clarke.agnes.benchmark.android