Skip to content

Commit

Permalink
Split file
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Aug 25, 2019
1 parent 712c0fb commit 4cb03b8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
31 changes: 31 additions & 0 deletions src/info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import uuidv4 from 'uuid/v4.js'

import { DATA_VERSION } from './store/migrate/main.js'
import { getSystems } from './system/info.js'
import { getCiInfo } from './ci/info.js'
import { cleanObject } from './utils/clean.js'

// Add more information to the final benchmark and normalize/sort results
export const addBenchmarkInfo = function(
iterations,
{ opts, opts: { group, system, cwd } },
) {
const version = DATA_VERSION
const id = uuidv4()
const timestamp = new Date().toISOString()
const { git, ci, job } = getCiInfo(cwd)
const systems = getSystems({ opts, system, job })
const rawBenchmark = {
version,
id,
timestamp,
group,
systems,
git,
ci,
iterations,
}

const rawBenchmarkA = cleanObject(rawBenchmark)
return rawBenchmarkA
}
31 changes: 1 addition & 30 deletions src/run.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import pMapSeries from 'p-map-series'
import pFinally from 'p-finally'
import uuidv4 from 'uuid/v4.js'

import { startProgress } from './progress/start.js'
import { stopProgress } from './progress/stop.js'
import { getIterations } from './iterations/main.js'
import { runProcesses } from './processes/main.js'
import { DATA_VERSION } from './store/migrate/main.js'
import { getSystems } from './system/info.js'
import { getCiInfo } from './ci/info.js'
// eslint-disable-next-line import/max-dependencies
import { cleanObject } from './utils/clean.js'
import { addBenchmarkInfo } from './info.js'

// Run a new benchmark
export const runBenchmark = async function(opts) {
Expand Down Expand Up @@ -38,27 +33,3 @@ const computeBenchmark = async function({
const rawBenchmark = addBenchmarkInfo(iterationsA, { opts, versions })
return rawBenchmark
}

// Add more information to the final benchmark and normalize/sort results
const addBenchmarkInfo = function(
iterations,
{ opts, opts: { group, system, cwd } },
) {
const version = DATA_VERSION
const id = uuidv4()
const timestamp = new Date().toISOString()
const { git, ci, job } = getCiInfo(cwd)
const systems = getSystems({ opts, system, job })
const rawBenchmark = {
version,
id,
timestamp,
group,
systems,
git,
ci,
iterations,
}
const rawBenchmarkA = cleanObject(rawBenchmark)
return rawBenchmarkA
}

0 comments on commit 4cb03b8

Please sign in to comment.