Skip to content

Add JSON schema #22

@mxmlnkn

Description

@mxmlnkn

For a quick check for correctness of the profile summaries, I propose to add a schema definition file to this repo:

profile-summary.1.schema.json: JSON schema matching the current format

{
  "$schema": "http://json-schema.org/schema#",
  "type": "object",
  "properties":
  {
    "Trace": {
      "type": "object",
      "properties":
      {
        "FileName": { "type": "string" },
        "Id": { "type": "integer" }
      }
    },
    "JobId": { "type": "integer" },
    "NodeCount": { "type": "integer", "minimum": 0 },
    "ProcessCount": { "type": "integer", "minimum": 0 },
    "ThreadCount": { "type": "integer", "minimum": 0 },
    "TimerResolution": { "type": "integer", "minimum": 0 },
    "HardwareCounters": { "type": "array" },
    "Functions": {
      "type": "object",
      "patternProperties":
      {
        "":
        {
          "type": "object",
          "properties":
          {
            "Count": { "type": "integer", "minimum": 0 },
            "Time": { "type": "integer", "minimum": 0 }
          }
        }
      }
    },
    "Messages": {
      "type": "object",
      "patternProperties": { "": { "type": "object" } }
    },
    "CollectiveOperations": {
      "type": "object",
      "patternProperties": { "": { "type": "object" } }
    },
    "IOOperations": {
      "patternProperties":
      {
        "":
        {
          "type": "object",
          "properties":
          {
            "Bytes": { "type": "integer", "minimum": 0 },
            "Count": { "type": "integer", "minimum": 0 },
            "MetaOperationTime": { "type": "integer", "minimum": 0 },
            "TransferOperationTime": { "type": "integer", "minimum": 0 }
          }
        }
      }
    },
    "Files": {
      "type": "array",
      "items":
      {
        "type": "object",
        "properties":
        {
          "FileName": { "type": "string" },
          "IoParadigm": {
            "type": "array",
            "items": { "type": "string" }
          },
          "AccessModes": { "type": "string", "pattern": "^[RWXS]+$" },
          "ParentFile": { "type": [ "string", "null" ] }
        }
      }
    },
    "ParallelRegionTime": { "type": "integer", "minimum": 0 },
    "SerialRegionTime": { "type": "integer", "minimum": 0 },
    "TotalFunctions": { "type": "integer", "minimum": 0 },
    "TotalCalls": { "type": "integer", "minimum": 0 }
  }
}

However, I'm quite unhappy with having to use patternProperties. Imho, IOOperations, Functions, Messages, CollectiveOperations, Files should not be objects with contents name : object but instead should be lists [ { name: ..., content1: ..., ... }, ... ]. In that case, the Schema would look like below:

profile-summary.2.schema.json: Proposed schema (untested)

{
  "$schema": "http://json-schema.org/schema#",
  "type": "object",
  "properties":
  {
    "Trace": {
      "type": "object",
      "properties":
      {
        "FileName": { "type": "string" },
        "Id": { "type": "integer" }
      }
    },
    "JobId": { "type": "integer" },
    "NodeCount": { "type": "integer", "minimum": 0 },
    "ProcessCount": { "type": "integer", "minimum": 0 },
    "ThreadCount": { "type": "integer", "minimum": 0 },
    "TimerResolution": { "type": "integer", "minimum": 0 },
    "HardwareCounters": { "type": "array" },
    "Functions": {
      "type": "array",
      "items":
      {
        "type": "object",
        "properties":
        {
          "Count": { "type": "integer", "minimum": 0 },
          "Time": { "type": "integer", "minimum": 0 }
        }
      }
    },
    "Messages": {
      "type": "object",
      "items": { "type": "object" }
    },
    "CollectiveOperations": {
      "type": "object",
      "items": { "type": "object" }
    },
    "IOOperations": {
      "items":
      {
        "type": "object",
        "properties":
        {
          "Bytes": { "type": "integer", "minimum": 0 },
          "Count": { "type": "integer", "minimum": 0 },
          "MetaOperationTime": { "type": "integer", "minimum": 0 },
          "TransferOperationTime": { "type": "integer", "minimum": 0 }
        }
      }
    },
    "Files": {
      "type": "array",
      "items":
      {
        "type": "object",
        "properties":
        {
          "FileName": { "type": "string" },
          "IoParadigm": {
            "type": "array",
            "items": { "type": "string" }
          },
          "AccessModes": { "type": "string", "pattern": "^[RWXS]+$" },
          "ParentFile": { "type": [ "string", "null" ] }
        }
      }
    },
    "ParallelRegionTime": { "type": "integer", "minimum": 0 },
    "SerialRegionTime": { "type": "integer", "minimum": 0 },
    "TotalFunctions": { "type": "integer", "minimum": 0 },
    "TotalCalls": { "type": "integer", "minimum": 0 }
  }
}

However, I'm not sure which of entries should be made required. I think at least TimerResoultion should be made required as else all the times are useless. But on the other hand, maybe we are not intersted in times but only in file accesses, ...

Also, a version number as proposed in #19 is not yet included in the schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions