1#!/bin/bash
 2#============================================================================
 3#
 4# NAME
 5#
 6#     runningTime.sh
 7#
 8# DESCRIPTION
 9#
10#     Measure primitive polynomial running time.
11#
12# USAGE
13#
14#     Collect data using
15#
16#         ./runningTime.sh
17#
18#     Plot the times using the script
19#
20#         ./plotRunningTime.sh
21#
22# NOTES
23#
24#     numpy:                            http://www.numpy.org
25#     matplotlib                        https://matplotlib.org
26#     Python interpreter:               http://www.python.org
27#     Python tutorial and reference:    htttp://docs.python.org/lib/lib.html
28#
29# LEGAL
30#
31#     Primpoly Version 16.4 - A Program for Computing Primitive Polynomials.
32#     Copyright (C) 1999-2025 by Sean Erik O'Connor.  All Rights Reserved.
33#
34#     This program is free software: you can redistribute it and/or modify
35#     it under the terms of the GNU General Public License as published by
36#     the Free Software Foundation, either version 3 of the License, or
37#     (at your option) any later version.
38#
39#     This program is distributed in the hope that it will be useful,
40#     but WITHOUT ANY WARRANTY; without even the implied warranty of
41#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
42#     GNU General Public License for more details.
43#
44#     You should have received a copy of the GNU General Public License
45#     along with this program.  If not, see <http://www.gnu.org/licenses/>.
46#    
47#     The author's address is seanerikoconnor!AT!gmail!DOT!com
48#     with the !DOT! replaced by . and the !AT! replaced by @
49#
50#============================================================================
51
52# ----------------------------------------
53# Collect timing results for Primpoly
54# ----------------------------------------
55
56function TimePrimpoly()
57{
58    time ${PRIMPOLYEXE} 2   2
59    time ${PRIMPOLYEXE} 2  10
60    time ${PRIMPOLYEXE} 2  30
61    time ${PRIMPOLYEXE} 2  50
62    time ${PRIMPOLYEXE} 2  70
63    time ${PRIMPOLYEXE} 2  90
64    time ${PRIMPOLYEXE} 2 100
65    time ${PRIMPOLYEXE} 2 120
66    time ${PRIMPOLYEXE} 2 140
67    time ${PRIMPOLYEXE} 2 145
68    time ${PRIMPOLYEXE} 2 150
69    time ${PRIMPOLYEXE} 2 160
70    time ${PRIMPOLYEXE} 2 180
71    time ${PRIMPOLYEXE} 2 200
72    time ${PRIMPOLYEXE} 2 202
73    time ${PRIMPOLYEXE} 2 210
74    time ${PRIMPOLYEXE} 2 300
75}
76
77function TimeExe()
78{
79    PRIMPOLYEXE="Bin/Primpoly.exe"
80
81    if [ -f ${PRIMPOLYEXE} ] ; then
82        TimePrimpoly
83    else
84        echo "File ${PRIMPOLYEXE} not found"
85        exit 1
86    fi
87}
88
89# Actually run the timing.
90TimeExe