Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions drishti/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,38 +545,41 @@ def main():
# Get the files responsible for more than half of these accesses
files = []

df['counters']['INSIGHTS_POSIX_SMALL'] = (
df['counters']['INSIGHTS_POSIX_SMALL_READ'] = (
df['counters']['POSIX_SIZE_READ_0_100'] +
df['counters']['POSIX_SIZE_READ_100_1K'] +
df['counters']['POSIX_SIZE_READ_1K_10K'] +
df['counters']['POSIX_SIZE_READ_10K_100K'] +
df['counters']['POSIX_SIZE_WRITE_100K_1M'] +
df['counters']['POSIX_SIZE_READ_100K_1M']
)

df['counters']['INSIGHTS_POSIX_SMALL_WRITE'] = (
df['counters']['POSIX_SIZE_WRITE_0_100'] +
df['counters']['POSIX_SIZE_WRITE_100_1K'] +
df['counters']['POSIX_SIZE_WRITE_1K_10K'] +
df['counters']['POSIX_SIZE_WRITE_10K_100K'] +
df['counters']['POSIX_SIZE_WRITE_100K_1M']
)

detected_files = pd.DataFrame(df['counters'].groupby('id')['INSIGHTS_POSIX_SMALL'].sum()).reset_index()
detected_files.columns = ['id', 'total']
detected_files = pd.DataFrame(df['counters'].groupby('id')[['INSIGHTS_POSIX_SMALL_READ', 'INSIGHTS_POSIX_SMALL_WRITE']].sum()).reset_index()
detected_files.columns = ['id', 'total_reads', 'total_writes']
detected_files.loc[:, 'id'] = detected_files.loc[:, 'id'].astype(str)

if total_reads_small and total_reads_small / total_reads > THRESHOLD_SMALL_REQUESTS and total_reads_small > THRESHOLD_SMALL_REQUESTS_ABSOLUTE:
issue = 'Application issues a high number ({}) of small read requests (i.e., < 1MB) which represents {:.2f}% of all read/write requests'.format(
issue = 'Application issues a high number ({}) of small read requests (i.e., < 1MB) which represents {:.2f}% of all read requests'.format(
total_reads_small, total_reads_small / total_reads * 100.0
)

detail = []
recommendation = []

for index, row in detected_files.iterrows():
if row['total'] > (total_reads * THRESHOLD_SMALL_REQUESTS / 2):
if row['total_reads'] > (total_reads * THRESHOLD_SMALL_REQUESTS / 2):
detail.append(
{
'message': '{} ({:.2f}%) small read requests are to "{}"'.format(
row['total'],
row['total'] / total_reads * 100.0,
row['total_reads'],
row['total_reads'] / total_reads * 100.0,
file_map[int(row['id'])] if args.full_path else os.path.basename(file_map[int(row['id'])])
)
}
Expand Down Expand Up @@ -616,20 +619,20 @@ def main():
)

if total_writes_small and total_writes_small / total_writes > THRESHOLD_SMALL_REQUESTS and total_writes_small > THRESHOLD_SMALL_REQUESTS_ABSOLUTE:
issue = 'Application issues a high number ({}) of small write requests (i.e., < 1MB) which represents {:.2f}% of all read/write requests'.format(
issue = 'Application issues a high number ({}) of small write requests (i.e., < 1MB) which represents {:.2f}% of all write requests'.format(
total_writes_small, total_writes_small / total_writes * 100.0
)

detail = []
recommendation = []

for index, row in detected_files.iterrows():
if row['total'] > (total_writes * THRESHOLD_SMALL_REQUESTS / 2):
if row['total_writes'] > (total_writes * THRESHOLD_SMALL_REQUESTS / 2):
detail.append(
{
'message': '{} ({:.2f}%) small write requests are to "{}"'.format(
row['total'],
row['total'] / total_writes * 100.0,
row['total_writes'],
row['total_writes'] / total_writes * 100.0,
file_map[int(row['id'])] if args.full_path else os.path.basename(file_map[int(row['id'])])
)
}
Expand Down