MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / main

Method main

serving/processor/tests/flatbuf_test/java/perf.java:517–632  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

515 }
516
517 public static void main(String[] args) {
518
519 String signatureName = "default_serving";
520 String[] inputNames = new String[TOTAL_COUNT];
521 int[] dataTypes = new int[TOTAL_COUNT];
522 long[][] shapes = new long[TOTAL_COUNT][2];
523 float[][] floatContent = new float[FLOAT_COUNT][DIM_0*DIM_1];
524 long[][] longContent = new long[LONG_COUNT][DIM_0*DIM_1];
525 double[][] doubleContent = new double[DOUBLE_COUNT][DIM_0*DIM_1];
526 int[][] intContent = new int[INT_COUNT][DIM_0*DIM_1];
527 String[][] stringContent = new String[STRING_COUNT][DIM_0*DIM_1];
528 String[] fetchNames = new String[3];
529
530 prepareData(signatureName, inputNames, dataTypes, shapes,
531 floatContent, longContent, doubleContent,
532 intContent, stringContent, fetchNames);
533
534 if (PRINT_DATA) {
535 printData(signatureName, inputNames, dataTypes, shapes,
536 floatContent, longContent, doubleContent,
537 intContent, stringContent, fetchNames);
538 }
539
540 // ================ flatbuffer ===================
541 double startFBMillis = System.currentTimeMillis();
542 int fbLen = 0;
543 for (int x = 0; x < TESTING_COUNT; ++x) {
544 // encode
545 FlatBufferBuilder fbb = new FlatBufferBuilder(20000);
546
547 // no copy here, convert user content to
548 // flatbuffer data directly.
549 encodeByFlatBuffer(fbb, signatureName, inputNames, dataTypes,
550 shapes, floatContent, longContent,
551 doubleContent, intContent,
552 stringContent, fetchNames);
553
554 byte[] buf = fbb.sizedByteArray();
555 fbLen = buf.length;
556
557 if (WRITE_TO_FILE) {
558 try {
559 File file = new File("/tmp/request_buf.bin");
560 FileOutputStream fop = new FileOutputStream(file);
561 fop.write(buf);
562 fop.flush();
563 fop.close();
564 } catch (IOException e) {
565 e.printStackTrace();
566 }
567 }
568
569 if (PRINT_FB) {
570 printFB(ByteBuffer.wrap(buf));
571 }
572 }
573 double endFBMillis = System.currentTimeMillis();
574

Callers

nothing calls this directly

Calls 9

prepareDataMethod · 0.95
printDataMethod · 0.95
encodeByFlatBufferMethod · 0.95
printFBMethod · 0.95
printPBMethod · 0.95
addFeedMethod · 0.80
closeMethod · 0.65
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected