Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/OudomMunint/Benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
OudomMunint committed Jun 3, 2023
2 parents 9e01a23 + e561380 commit 93a8f78
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 10 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '23 10 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
9 changes: 7 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
workflow_dispatch:

permissions:
contents: read

contents: write
env:
DOTNET_NOLOGO: true # Disable the .NET logo
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience
Expand Down Expand Up @@ -94,3 +94,8 @@ jobs:

- name: Build sln
run: dotnet build Benchmark.sln -c Release -f net7.0

- name: Create Release
uses: ncipollo/[email protected]
with:
tag: v1.0.1
9 changes: 4 additions & 5 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@

if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
static void Main(string[] args)
{
var startInfo = new ProcessStartInfo

var startInfo = new ProcessStartInfo
{
FileName = "/usr/sbin/system_profiler",
Arguments = "SPSoftwareDataType SPHardwareDataType",
Arguments = " sudo SPHardwareDataType SPDisplaysDataType",
RedirectStandardOutput = true,
UseShellExecute = false
};
Expand All @@ -31,7 +30,7 @@ static void Main(string[] args)
}

process.WaitForExit();
}

}

else
Expand Down
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Benchmark

[![CI Build](https://github.com/OudomMunint/Benchmark/actions/workflows/main.yml/badge.svg)](https://github.com/OudomMunint/Benchmark/actions/workflows/main.yml)
[![CI Build](https://github.com/OudomMunint/Benchmark/actions/workflows/main.yml/badge.svg)](https://github.com/OudomMunint/Benchmark/actions/workflows/main.yml) [![CodeQL](https://github.com/OudomMunint/Benchmark/actions/workflows/codeql.yml/badge.svg)](https://github.com/OudomMunint/Benchmark/actions/workflows/codeql.yml) ![maintenance-status](https://img.shields.io/badge/maintenance-actively--developed-brightgreen.svg)

- A C# console program that gathers your system details then runs a hash benchmark on MD5, SHA256, SHA512
- Used <a href="https://github.com/dotnet/BenchmarkDotNet"> `BenchmarkDotNet` </a>
Expand All @@ -10,8 +10,18 @@
- Check your if system specs is correct
- `Y` to continue

# Output
<img src="results.png"/>
# Output
<table>
<tr>
<td> <h3>Windows 11</h3> </td>
<td> <h3>MacOS Ventura</h3> </td>
</tr>
<tr>
<td> <img src="results.png"/> </td>
<td> <img src="macresults.png"/> </td>
</tr>
</table>


- Scroll down to see results.
- `Runtime` in `seconds(s)` should be the benchmark.
Expand All @@ -29,6 +39,18 @@ Intel Core i7-8850H CPU 2.60GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical
| Sha512 | 232.6 μs | 4.48 μs | 4.19 μs |
| Md5 | 174.0 μs | 2.08 μs | 1.94 μs |

## MacBookPro 15" 2018 `MacOS 13`
``` ini
Intel Core i7-8850H CPU 2.60GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores (6P/0E)
```
- Runtime: `191s`

| Method | Mean | Error | StdDev |
|------- |---------:|--------:|---------:|
| Sha256 | 240.3 us | 4.79 us | 13.97 us |
| Sha512 | 150.2 us | 0.63 us | 0.59 us |
| Md5 | 161.7 us | 1.21 us | 1.07 us |

## Desktop
``` ini
Intel Core i7-8700K CPU 3.70GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores (6P/0E)
Expand Down
Binary file added macresults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 93a8f78

Please sign in to comment.