API Programming Guide

Overview

This document provides essential programming information to monitor Virtium SSDs.

steps to access StorFly SSD using vtView API. Follow these essential steps will ensure your software produces derired result. Please contact Virtium application engineering support if you have question or need to deal with the uniqueness of your system.

Step 1: Discover System SSDs
  • Make sure to run with Administrator privilege to communicate with SSDs.
    • Windows: equivalent to “Run as administrator”
    • Linux: equivalent to “sudo application_name”
  • Discover all system SSDs and obtain their serial numbers.
  • Use GetDeviceArray () function to discover the SSD and retrieve their identify information.  Read more >
Code snippet

vector <vtViewApi::sDeviceIdentification> deviceArray;

vtViewApi::GetDeviceArray (deviceArray);

Step 2: Start Logging SMART data

Set up logging configuration

  • Specify log file
  • Specify target drives (using a set of serial numbers obtained in step 1).
  • Specify how often to log and how long to log
Operation
  • Invoke function StartLogging (). Read more >
  • The call to StartLogging will create one thread
  • The next subsequent call to StartLogging will do nothing.
  • Sequence of operation is: StartLogging, StopLogging, and then startLogging can be called again.

Code snippet

// Build LogSetting
VtViewApi::sLogSetting logSetting;
logSetting.FileName = “smartlog.txt”; // Write SMART data to this file
logSetting.SerialSet.insert(serialNo);
logSetting.DurationInSec = 100; // Logging in 100 seconds
logSetting.FrequencyInSec = 20; // Read SMART data every 20 seconds
// Start Logging
if (false == VtViewApi::StartLogging(logSetting))
{
cout << “Cannot start logging on device ” << serialNo << endl;
return (0);
}
Step 3: Stop Logging SMART data

Operation

  • Invoke function StopLogging (). Read more >
  • This call will terminate all logging from previous called startLogging ().
  • vtView API returns false if StopLogging is called repeatedly. That is, StartLogging () and StopLogging () must be invoked in pair.

Code snippet

VtViewApi::StopLogging ()
Step 4a: Retrieve Usage Statistics

Operation

  • Specify SSD and data range to retrieve usage statistics. Set parameters in sUsageStatisticsSetting data structure
    • set serial number
    • set “start record”: this is the first index in the record array.
    • set “record count”: this is the number of record following the “start record”.
      Example: start record = 0; record count = 10; records 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 are retrieved.
  • Retrieve usage statistics data. Calling GetUsageStatistics (). Read more >
Code snippet
// Extract Health information from last 3 records
VtViewApi::sLifeInfoSetting lifeSetting;
lifeSetting.SerialNo = serialNo;
lifeSetting.StartRecord = 2;
lifeSetting.RecordCount = 3;
VtViewApi::sLifeAccelerationInfo lifeInfo;
if (false == VtViewApi::GetLifeAccelerationInfo(lifeSetting, lifeInfo))
{
cout << “Cannot read life information of device ” << serialNo << endl;
}
else
{
printLifeInformation(lifeInfo);
}
Step 4b: Retrieve Power-off Data Retention

Operation

  • Invoke function GetPowerOffDataRetentionEstimate (). Read more >

Code snippet

rc = VtViewApi::GetPowerOffDataRetentionEstimate ( serial number, retention information)
Step 5: Release Log Data

Operation

  • Invoke function ReleaseLogData ( ). Read more >
  • Release all memory resource

Code snippet

VtViewApi::ReleaseLogData ()